home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / linux / src / lnx09p2.dgz / linux-0.9pl2.diffs
Encoding:
Text File  |  1994-08-14  |  285.3 KB  |  10,187 lines

  1. diff -cr --new-file linux-0.9pl1/Makefile linux-0.9pl2/Makefile
  2. *** linux-0.9pl1/Makefile    Thu Jul 28 21:32:48 1994
  3. --- linux-0.9pl2/Makefile    Fri Aug  5 12:58:53 1994
  4. ***************
  5. *** 8,14 ****
  6.   
  7.   VERSION = 0
  8.   PATCHLEVEL = 9
  9. ! SUBLEVEL = 1
  10.   
  11.   all:    Version vmlinux
  12.   
  13. --- 8,14 ----
  14.   
  15.   VERSION = 0
  16.   PATCHLEVEL = 9
  17. ! SUBLEVEL = 2
  18.   
  19.   all:    Version vmlinux
  20.   
  21. ***************
  22. *** 76,87 ****
  23.   endif
  24.   
  25.   ifdef CONFIG_AMIGA
  26. ! BOOTOBJS := tools/amiga/bootstrap.o tools/amiga/get_nlist.o
  27.   ARCHIVES := $(ARCHIVES) amiga/amiga.o
  28.   SUBDIRS := $(SUBDIRS) amiga
  29.   endif
  30.   
  31.   ifdef CONFIG_ATARI
  32.   ARCHIVES := $(ARCHIVES) atari/atari.o
  33.   SUBDIRS := $(SUBDIRS) atari
  34.   endif
  35. --- 76,88 ----
  36.   endif
  37.   
  38.   ifdef CONFIG_AMIGA
  39. ! AMIGA_BOOTOBJS := tools/amiga/bootstrap.o tools/amiga/get_nlist.o
  40.   ARCHIVES := $(ARCHIVES) amiga/amiga.o
  41.   SUBDIRS := $(SUBDIRS) amiga
  42.   endif
  43.   
  44.   ifdef CONFIG_ATARI
  45. + ATARI_BOOTOBJS := tools/atari/bootstrap.o tools/atari/get_nlist.o
  46.   ARCHIVES := $(ARCHIVES) atari/atari.o
  47.   SUBDIRS := $(SUBDIRS) atari
  48.   endif
  49. ***************
  50. *** 110,117 ****
  51.   linuxsubdirs: dummy
  52.       set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
  53.   
  54. ! bootstrap: $(BOOTOBJS)
  55. !     $(HOSTCC) $(HOSTFLAGS) -o $@ $(BOOTOBJS)
  56.   
  57.   tools/./version.h: tools/version.h
  58.   
  59. --- 111,129 ----
  60.   linuxsubdirs: dummy
  61.       set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
  62.   
  63. ! ifdef CONFIG_ATARI
  64. ! atari_bootstrap: $(ATARI_BOOTOBJS)
  65. !     $(HOSTCC) $(HOSTFLAGS) -o $@ $(ATARI_BOOTOBJS)
  66. !     rm -f bootstrap
  67. !     ln $@ bootstrap
  68. ! endif
  69. ! ifdef CONFIG_AMIGA
  70. ! amiga_bootstrap: $(AMIGA_BOOTOBJS)
  71. !     $(HOSTCC) $(HOSTFLAGS) -o $@ $(AMIGA_BOOTOBJS)
  72. !     rm -f bootstrap
  73. !     ln $@ bootstrap
  74. ! endif
  75.   
  76.   tools/./version.h: tools/version.h
  77.   
  78. ***************
  79. *** 141,164 ****
  80.           $(LIBS) \
  81.           -o vmlinux > System.map
  82.   
  83. ! # this target just creates an amigados format executable of
  84. ! # the kernel so that you can run an amigados disassembler on it.
  85. ! vmlinux.amigados : m68k/head.o init/main.o init/config.o tools/version.o linuxsubdirs
  86. !     $(HOSTCC) -nostdlib m68k/head.o init/main.o init/config.o \
  87. !         tools/version.o \
  88. !         $(ARCHIVES) \
  89. !         $(FILESYSTEMS) \
  90. !         $(DRIVERS) \
  91. !         $(LIBS) \
  92. !         -o vmlinux.amigados
  93.   
  94. ! m68k/head.o: m68k/head.S #m68k/assyms.h
  95. ! m68k/assyms.h: dummy
  96. !     make -C m68k assyms.h
  97. ! $(BOOTOBJS): $(BOOTOBJS:.o=.c)
  98. !     $(HOSTCC) $(HOSTFLAGS) -c $*.c -o $@
  99.   
  100.   fs: dummy
  101.       $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=fs
  102. --- 153,162 ----
  103.           $(LIBS) \
  104.           -o vmlinux > System.map
  105.   
  106. ! m68k/head.o: m68k/head.S
  107.   
  108. ! $(AMIGA_BOOTOBJS) $(ATARI_BOOTOBJS): $(AMIGA_BOOTOBJS:.o=.c) $(ATARI_BOOTOBJS:.o=.c)
  109. !     $(HOSTCC) $(HOSTFLAGS) -c $< -o $@
  110.   
  111.   fs: dummy
  112.       $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=fs
  113. ***************
  114. *** 181,186 ****
  115. --- 179,187 ----
  116.   amiga: dummy
  117.       $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=amiga
  118.   
  119. + atari: dummy
  120. +     $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=atari
  121.   m68k: dummy
  122.       $(MAKE) $(MFLAGS) linuxsubdirs SUBDIRS=m68k
  123.   
  124. ***************
  125. *** 213,222 ****
  126.   depend dep:
  127.       -touch tools/version.h
  128.       for i in init/*.c;do (echo -n init/;$(CPP) -M $(INCFLAGS) $$i); done > .tmpdepend
  129. !     for i in $(BOOTOBJS:.o=.c); do (echo -n tools/amiga/;$(HOSTCC) $(HOSTINCFLAGS) -M $$i); done >> .tmpdepend
  130. !     set -e ; for i in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$i dep; done
  131.       $(RM) $(RMFLAGS) tools/version.h
  132.       mv .tmpdepend .depend
  133.   
  134.   ifdef CONFIGURATION
  135.   ..$(CONFIGURATION):
  136. --- 214,232 ----
  137.   depend dep:
  138.       -touch tools/version.h
  139.       for i in init/*.c;do (echo -n init/;$(CPP) -M $(INCFLAGS) $$i); done > .tmpdepend
  140. !     $(foreach i, $(SUBDIRS), $(MAKE) $(MFLAGS) -C $i dep ;)
  141.       $(RM) $(RMFLAGS) tools/version.h
  142.       mv .tmpdepend .depend
  143. + amigadep:
  144. + ifdef CONFIG_AMIGA
  145. +     for i in $(AMIGA_BOOTOBJS:.o=.c); do (echo -n tools/amiga/;$(HOSTCC) $(HOSTINCFLAGS) -M $$i); done >> .depend
  146. + endif
  147. + ataridep:
  148. + ifdef CONFIG_ATARI
  149. +     for i in $(ATARI_BOOTOBJS:.o=.c); do (echo -n tools/atari/;$(HOSTCC) $(HOSTINCFLAGS) -M $$i); done >> .depend
  150. + endif
  151.   
  152.   ifdef CONFIGURATION
  153.   ..$(CONFIGURATION):
  154. diff -cr --new-file linux-0.9pl1/amiga/amicon.c linux-0.9pl2/amiga/amicon.c
  155. *** linux-0.9pl1/amiga/amicon.c    Wed Jun 29 17:27:03 1994
  156. --- linux-0.9pl2/amiga/amicon.c    Sun Aug 14 09:40:05 1994
  157. ***************
  158. *** 1519,1525 ****
  159.        */
  160.   
  161.       for (rows = p->fontheight ; rows-- ; dest += bytes)
  162. !         *dest = *cdat++;
  163.   
  164.       for (i = 1 ; i < p->scr_depth ; i++) {
  165.           dest = p->bitplane[i] + offset;
  166. --- 1519,1532 ----
  167.        */
  168.   
  169.       for (rows = p->fontheight ; rows-- ; dest += bytes)
  170. !     switch (mode) {
  171. !       case DM_COPY:
  172. !         *dest = *cdat++;
  173. !         break;
  174. !       case DM_INVERSE:
  175. !         *dest = ~*cdat++;
  176. !         break;
  177. !     }
  178.   
  179.       for (i = 1 ; i < p->scr_depth ; i++) {
  180.           dest = p->bitplane[i] + offset;
  181. ***************
  182. *** 1579,1610 ****
  183.            * d0 -- scratch  ; d1 -- count  ; d2 -- bytes
  184.            * 
  185.            */
  186. !         __asm__("movel  %1,d1   ; beq 5f      ; subqw #1,d1\n\t"
  187. !                 "movel  %0,a0   ; movel %2,a2 ; movel %3,a3;movel %4,d2\n\t"
  188. !              "1: moveb  a2@+,d0 ; extw d0\n\t"
  189. !                 "cmpb   #32,d0  ; jlt 2f ; cmpb #127,d0 ; jge 2f\n\t"
  190. !                    "subb   #32,d0  ; jra 3f\n\t"
  191. !              "2: cmpb   #160,d0 ; jlt 1b ; cmpb #255,d0 ; jeq 1b\n\t"
  192. !                    "subb   #64,d0\n\t"
  193. !              "3: lea    a3@(d0:w:8),a1 ; movel a0,sp@-\n\t"
  194. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 0 */
  195. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 1 */
  196. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 2 */
  197. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 3 */
  198. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 4 */
  199. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 5 */
  200. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 6 */
  201. !                " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 7 */
  202. !                 "movel  sp@+,a0 ; lea a0@(1),a0   ; dbra d1,1b\n\t"
  203. !              "5:"
  204. !                 :
  205. !                 : "g" (dest0), "g" (count), "g" (s),
  206. !                   "g" (p->fontdata), "g" ((ulong) bytes)
  207. !                 : "a0", "a1", "a2", "a3", "d0", "d1", "d2");
  208. !         return;
  209.       }
  210.   #endif
  211.   
  212.       while (count--) {
  213.           c    = *(s++); dest = dest0++;
  214.               
  215. --- 1586,1649 ----
  216.            * d0 -- scratch  ; d1 -- count  ; d2 -- bytes
  217.            * 
  218.            */
  219. !     switch (mode) {
  220. !       case DM_COPY:
  221. !         __asm__("movel  %1,d1   ; beq 5f      ; subqw #1,d1\n\t"
  222. !             "movel  %0,a0   ; movel %2,a2\n\t"
  223. !             "movel %3,a3;movel %4,d2\n\t"
  224. !             "1: moveb  a2@+,d0\n\t"
  225. !             "cmpb   #32,d0  ; jlt 2f ; cmpb #127,d0 ; jge 2f\n\t"
  226. !             "subb   #32,d0  ; jra 3f\n\t"
  227. !             "2: cmpb   #160,d0 ; jlt 1b ; cmpb #255,d0 ; jeq 1b\n\t"
  228. !             "subb   #64,d0\n\t"
  229. !             "3: lea    a3@(d0:w:8),a1 ; movel a0,sp@-\n\t"
  230. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 0 */
  231. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 1 */
  232. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 2 */
  233. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 3 */
  234. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 4 */
  235. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 5 */
  236. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 6 */
  237. !             " moveb  a1@+,a0@; lea a0@(d2:w),a0\n\t" /* 7 */
  238. !             "movel  sp@+,a0 ; lea a0@(1),a0   ; dbra d1,1b\n\t"
  239. !             "5:"
  240. !             :
  241. !             : "g" (dest0), "g" (count), "g" (s),
  242. !             "g" (p->fontdata), "g" ((ulong) bytes)
  243. !             : "a0", "a1", "a2", "a3", "d0", "d1", "d2");
  244. !         break;
  245. !       case DM_INVERSE:
  246. !         __asm__("movel  %1,d1   ; beq 5f      ; subqw #1,d1\n\t"
  247. !             "movel  %0,a0   ; movel %2,a2\n\t"
  248. !             "movel %3,a3;movel %4,d2\n\t"
  249. !             "1: moveb  a2@+,d0\n\t"
  250. !             "cmpb   #32,d0  ; jlt 2f ; cmpb #127,d0 ; jge 2f\n\t"
  251. !             "subb   #32,d0  ; jra 3f\n\t"
  252. !             "2: cmpb   #160,d0 ; jlt 1b ; cmpb #255,d0 ; jeq 1b\n\t"
  253. !             "subb   #64,d0\n\t"
  254. !             "3: lea    a3@(d0:w:8),a1 ; movel a0,sp@-\n\t"
  255. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 0 */
  256. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 1 */
  257. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 2 */
  258. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 3 */
  259. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 4 */
  260. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 5 */
  261. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 6 */
  262. !             " moveb  a1@+,d3; notb d3; moveb d3,a0@; lea a0@(d2:w),a0\n\t" /* 7 */
  263. !             "movel  sp@+,a0 ; lea a0@(1),a0   ; dbra d1,1b\n\t"
  264. !             "5:"
  265. !             :
  266. !             : "g" (dest0), "g" (count), "g" (s),
  267. !             "g" (p->fontdata), "g" ((ulong) bytes)
  268. !             : "a0", "a1", "a2", "a3", "d0", "d1", "d2", "d3");
  269. !         break;
  270. !     }
  271. !     return;
  272.       }
  273.   #endif
  274.   
  275. +     printk (__FILE__ ": Line %d shouldn't be executed\n", __LINE__);
  276.       while (count--) {
  277.           c    = *(s++); dest = dest0++;
  278.               
  279. ***************
  280. *** 1624,1630 ****
  281.   
  282.           cdat  = p->fontdata + (c * p->fontheight);
  283.           for (rows = p->fontheight ; rows-- ; dest += bytes)
  284. !             *dest = *cdat++;
  285.       }
  286.   }
  287.   
  288. --- 1663,1676 ----
  289.   
  290.           cdat  = p->fontdata + (c * p->fontheight);
  291.           for (rows = p->fontheight ; rows-- ; dest += bytes)
  292. !         switch (mode) {
  293. !           case DM_COPY:
  294. !         *dest = *cdat++;
  295. !         break;
  296. !           case DM_INVERSE:
  297. !         *dest = ~*cdat++;
  298. !         break;
  299. !         }
  300.       }
  301.   }
  302.   
  303. diff -cr --new-file linux-0.9pl1/amiga/amiints.c linux-0.9pl2/amiga/amiints.c
  304. *** linux-0.9pl1/amiga/amiints.c    Tue Jun  7 19:38:48 1994
  305. --- linux-0.9pl2/amiga/amiints.c    Sat Aug  6 23:51:49 1994
  306. ***************
  307. *** 84,90 ****
  308.   
  309.       /* turn off all interrupts and enable the master interrupt bit */
  310.       custom.intena = 0x7fff;
  311. !     custom.intreqr = 0x7fff;
  312.       custom.intena = 0xc000;
  313.   
  314.       /* turn off all CIA interrupts */
  315. --- 84,90 ----
  316.   
  317.       /* turn off all interrupts and enable the master interrupt bit */
  318.       custom.intena = 0x7fff;
  319. !     custom.intreq = 0x7fff;
  320.       custom.intena = 0xc000;
  321.   
  322.       /* turn off all CIA interrupts */
  323. diff -cr --new-file linux-0.9pl1/amiga/amikeyb.c linux-0.9pl2/amiga/amikeyb.c
  324. *** linux-0.9pl1/amiga/amikeyb.c    Thu Jul  7 21:18:10 1994
  325. --- linux-0.9pl2/amiga/amikeyb.c    Fri Aug  5 12:46:24 1994
  326. ***************
  327. *** 34,49 ****
  328.   /* 04-07 */    '4',    '5',    '6',    '7',
  329.   /* 08-0b */    '8',    '9',    '0',    '-',
  330.   /* 0c-0f */    '=',    '\\',    K_HOLE,    K_P0,
  331. ! /* 10-13 */    'q',    'w',    'e',    'r',
  332. ! /* 14-17 */    't',    'y',    'u',    'i',
  333. ! /* 18-1b */    'o',    'p',    '[',    ']',
  334.   /* 1c-1f */    K_HOLE,    K_P1,    K_P2,    K_P3,
  335. ! /* 20-23 */    'a',    's',    'd',    'f',
  336. ! /* 24-27 */    'g',    'h',    'j',    'k',
  337. ! /* 28-2b */    'l',    ';',    '\'',    K_HOLE,
  338.   /* 2c-2f */    K_HOLE,    K_P4,    K_P5,    K_P6,
  339. ! /* 30-33 */    K_HOLE,    'z',    'x',    'c',
  340. ! /* 34-37 */    'v',    'b',    'n',    'm',
  341.   /* 38-3b */    ',',    '.',    '/',    K_HOLE,
  342.   /* 3c-3f */    K_PDOT,    K_P7,    K_P8,    K_P9,
  343.   /* 40-43 */    ' ',    '?'|0x40,    'I'&0x1f,    K_PENTER,
  344. --- 34,49 ----
  345.   /* 04-07 */    '4',    '5',    '6',    '7',
  346.   /* 08-0b */    '8',    '9',    '0',    '-',
  347.   /* 0c-0f */    '=',    '\\',    K_HOLE,    K_P0,
  348. ! /* 10-13 */    K(KT_LETTER,'q'),    K(KT_LETTER,'w'),    K(KT_LETTER,'e'),    K(KT_LETTER,'r'),
  349. ! /* 14-17 */    K(KT_LETTER,'t'),    K(KT_LETTER,'y'),    K(KT_LETTER,'u'),    K(KT_LETTER,'i'),
  350. ! /* 18-1b */    K(KT_LETTER,'o'),    K(KT_LETTER,'p'),    '[',    ']',
  351.   /* 1c-1f */    K_HOLE,    K_P1,    K_P2,    K_P3,
  352. ! /* 20-23 */    K(KT_LETTER,'a'),    K(KT_LETTER,'s'),    K(KT_LETTER,'d'),    K(KT_LETTER,'f'),
  353. ! /* 24-27 */    K(KT_LETTER,'g'),    K(KT_LETTER,'h'),    K(KT_LETTER,'j'),    K(KT_LETTER,'k'),
  354. ! /* 28-2b */    K(KT_LETTER,'l'),    ';',    '\'',    K_HOLE,
  355.   /* 2c-2f */    K_HOLE,    K_P4,    K_P5,    K_P6,
  356. ! /* 30-33 */    K_HOLE,    K(KT_LETTER,'z'),    K(KT_LETTER,'x'),    K(KT_LETTER,'c'),
  357. ! /* 34-37 */    K(KT_LETTER,'v'),    K(KT_LETTER,'b'),    K(KT_LETTER,'n'),    K(KT_LETTER,'m'),
  358.   /* 38-3b */    ',',    '.',    '/',    K_HOLE,
  359.   /* 3c-3f */    K_PDOT,    K_P7,    K_P8,    K_P9,
  360.   /* 40-43 */    ' ',    '?'|0x40,    'I'&0x1f,    K_PENTER,
  361. ***************
  362. *** 67,82 ****
  363.   /* 04-07 */    '$',    '%',    '^',    '&',
  364.   /* 08-0b */    '*',    '(',    ')',    '_',
  365.   /* 0c-0f */    '+',    '|',    K_HOLE,    K_P0,
  366. ! /* 10-13 */    'Q',    'W',    'E',    'R',
  367. ! /* 14-17 */    'T',    'Y',    'U',    'I',
  368. ! /* 18-1b */    'O',    'P',    '{',    '}',
  369.   /* 1c-1f */    K_HOLE,    K_P1,    K_P2,    K_P3,
  370. ! /* 20-23 */    'A',    'S',    'D',    'F',
  371. ! /* 24-27 */    'G',    'H',    'J',    'K',
  372. ! /* 28-2b */    'L',    ':',    '"',    K_HOLE,
  373.   /* 2c-2f */    K_HOLE,    K_P4,    K_P5,    K_P6,
  374. ! /* 30-33 */    K_HOLE,    'Z',    'X',    'C',
  375. ! /* 34-37 */    'V',    'B',    'N',    'M',
  376.   /* 38-3b */    '<',    '>',    '?',    K_HOLE,
  377.   /* 3c-3f */    K_PDOT,    K_P7,    K_P8,    K_P9,
  378.   /* 40-43 */    ' ',    '?'|0x40,    'I'&0x1f,    K_PENTER,
  379. --- 67,82 ----
  380.   /* 04-07 */    '$',    '%',    '^',    '&',
  381.   /* 08-0b */    '*',    '(',    ')',    '_',
  382.   /* 0c-0f */    '+',    '|',    K_HOLE,    K_P0,
  383. ! /* 10-13 */    K(KT_LETTER,'Q'),    K(KT_LETTER,'W'),    K(KT_LETTER,'E'),    K(KT_LETTER,'R'),
  384. ! /* 14-17 */    K(KT_LETTER,'T'),    K(KT_LETTER,'Y'),    K(KT_LETTER,'U'),    K(KT_LETTER,'I'),
  385. ! /* 18-1b */    K(KT_LETTER,'O'),    K(KT_LETTER,'P'),    '{',    '}',
  386.   /* 1c-1f */    K_HOLE,    K_P1,    K_P2,    K_P3,
  387. ! /* 20-23 */    K(KT_LETTER,'A'),    K(KT_LETTER,'S'),    K(KT_LETTER,'D'),    K(KT_LETTER,'F'),
  388. ! /* 24-27 */    K(KT_LETTER,'G'),    K(KT_LETTER,'H'),    K(KT_LETTER,'J'),    K(KT_LETTER,'K'),
  389. ! /* 28-2b */    K(KT_LETTER,'L'),    ':',    '"',    K_HOLE,
  390.   /* 2c-2f */    K_HOLE,    K_P4,    K_P5,    K_P6,
  391. ! /* 30-33 */    K_HOLE,    K(KT_LETTER,'Z'),    K(KT_LETTER,'X'),    K(KT_LETTER,'C'),
  392. ! /* 34-37 */    K(KT_LETTER,'V'),    K(KT_LETTER,'B'),    K(KT_LETTER,'N'),    K(KT_LETTER,'M'),
  393.   /* 38-3b */    '<',    '>',    '?',    K_HOLE,
  394.   /* 3c-3f */    K_PDOT,    K_P7,    K_P8,    K_P9,
  395.   /* 40-43 */    ' ',    '?'|0x40,    'I'&0x1f,    K_PENTER,
  396. diff -cr --new-file linux-0.9pl1/atari/Makefile linux-0.9pl2/atari/Makefile
  397. *** linux-0.9pl1/atari/Makefile    Wed Jun 29 17:09:10 1994
  398. --- linux-0.9pl2/atari/Makefile    Fri Aug  5 12:46:45 1994
  399. ***************
  400. *** 9,15 ****
  401.   include ../MakeVars
  402.   
  403.   OBJS    = config.o atakeyb.o ataints.o atacon.o font_8x16.o font_8x8.o \
  404. !           atapart.o stdma.o atasound.o joystick.o
  405.   
  406.   atari.o: $(OBJS)
  407.       $(LD) -r -o atari.o $(OBJS)
  408. --- 9,15 ----
  409.   include ../MakeVars
  410.   
  411.   OBJS    = config.o atakeyb.o ataints.o atacon.o font_8x16.o font_8x8.o \
  412. !           atapart.o stdma.o atasound.o joystick.o stram.o
  413.   
  414.   atari.o: $(OBJS)
  415.       $(LD) -r -o atari.o $(OBJS)
  416. diff -cr --new-file linux-0.9pl1/atari/atacon.c linux-0.9pl2/atari/atacon.c
  417. *** linux-0.9pl1/atari/atacon.c    Wed Jun 29 15:49:16 1994
  418. --- linux-0.9pl2/atari/atacon.c    Sat Aug  6 19:36:19 1994
  419. ***************
  420. *** 61,68 ****
  421.   
  422.   #define    WHOLE_FONT
  423.   
  424. - static unsigned long mem_req;
  425.   /* There is no support for fontwidth != 8 now!! (And I guess, it will
  426.    * never come; who needs such stuff??)
  427.    */
  428. --- 61,66 ----
  429. ***************
  430. *** 176,187 ****
  431.       struct display_switch *dispsw;    /* pointers to depth specific
  432.                                        * functions
  433.                                        */
  434.   };
  435.   
  436.   static struct display disp[NR_CONSOLES];
  437.   
  438.   static struct tt_vid_type tt_video_modes[TT_SHIFTER_NUMMODE] = {
  439. !     { "stlow",   320 , 200 , 1 } ,            /* ST-Low */
  440.       { "stmid",   640 , 200 , 2 } ,            /* ST-Mid */
  441.       { "sthigh",  640 , 400 , 1 } ,            /* ST-High */
  442.       { "",        000 , 000 , 0 } ,            /* unused */
  443. --- 174,188 ----
  444.       struct display_switch *dispsw;    /* pointers to depth specific
  445.                                        * functions
  446.                                        */
  447. +     u_char *screen_base;
  448. +     u_char *screen_end;
  449. +     ;
  450.   };
  451.   
  452.   static struct display disp[NR_CONSOLES];
  453.   
  454.   static struct tt_vid_type tt_video_modes[TT_SHIFTER_NUMMODE] = {
  455. !     { "stlow",   320 , 200 , 4 } ,            /* ST-Low */
  456.       { "stmid",   640 , 200 , 2 } ,            /* ST-Mid */
  457.       { "sthigh",  640 , 400 , 1 } ,            /* ST-High */
  458.       { "",        000 , 000 , 0 } ,            /* unused */
  459. ***************
  460. *** 532,551 ****
  461.                */
  462.   
  463.               if (atacon_default_shiftmode != -1)
  464. !                 if ((mono_moni && atacon_default_shiftmode != TT_HIGH) ||
  465. !                     (!mono_moni && atacon_default_shiftmode == TT_HIGH))
  466. !                     atacon_default_shiftmode = -1;
  467.           
  468.               /* Set a default shift mode, if none was given on the command
  469.                * line or that isn't possible.
  470.                */
  471.               if (atacon_default_shiftmode == -1)
  472. !                 atacon_default_shiftmode = mono_moni ? TT_HIGH :
  473. ! #ifdef CONFIG_ATARI_4PLANE
  474. !                     ST_HIGH;
  475. ! #else
  476. !                     TT_MID;
  477. ! #endif
  478.   
  479.               /* Initialize the shift mode, palette bank = 0 */
  480.               shifter_tt.tt_shiftmode = atacon_default_shiftmode << 8;
  481. --- 533,547 ----
  482.                */
  483.   
  484.               if (atacon_default_shiftmode != -1)
  485. !               if (mono_moni != (atacon_default_shiftmode == TT_HIGH))
  486. !                 atacon_default_shiftmode = -1;
  487.           
  488.               /* Set a default shift mode, if none was given on the command
  489.                * line or that isn't possible.
  490.                */
  491.               if (atacon_default_shiftmode == -1)
  492. !               atacon_default_shiftmode
  493. !                 = (shifter_tt.tt_shiftmode >> 8) & 7;
  494.   
  495.               /* Initialize the shift mode, palette bank = 0 */
  496.               shifter_tt.tt_shiftmode = atacon_default_shiftmode << 8;
  497. ***************
  498. *** 594,599 ****
  499. --- 590,597 ----
  500.   static long atacon_init(struct condata *conp, long mem_start)
  501.   {
  502.       int unit = conp - vc_cons;    
  503. +     unsigned long mem_req;
  504. +     u_char *screen_base;
  505.   
  506.       /* set up the display defaults */
  507.       detect_video( &disp[unit].scr_height, &disp[unit].scr_width,
  508. ***************
  509. *** 668,679 ****
  510.       mem_req = (disp[unit].scr_width/8)*disp[unit].scr_height*
  511.                 disp[unit].scr_depth;
  512.       /* locate the bitplane */
  513. !     mem_start = (mem_start + 7) & ~7; /* round up */
  514. !     disp[unit].bitplane = (u_char *)mem_start;
  515. !     mem_start += mem_req;
  516. !     mymemclear( disp[unit].bitplane, mem_req );
  517.   
  518. !     shifter_init( (u_long)(disp[unit].bitplane) );
  519.       
  520.   
  521.   #ifdef CURSOR_DELAY_VBL
  522. --- 666,678 ----
  523.       mem_req = (disp[unit].scr_width/8)*disp[unit].scr_height*
  524.                 disp[unit].scr_depth;
  525.       /* locate the bitplane */
  526. !     screen_base = atari_stram_alloc (mem_req * 2 + 8);
  527. !     screen_base = (u_char *) (((u_long) screen_base + 7) & ~7);
  528. !     disp[unit].screen_base = disp[unit].bitplane = screen_base;
  529. !     disp[unit].screen_end = screen_base + mem_req;
  530. !     memset (screen_base, 0, mem_req);
  531.   
  532. !     shifter_init ((unsigned long)screen_base);
  533.       
  534.   
  535.   #ifdef CURSOR_DELAY_VBL
  536. diff -cr --new-file linux-0.9pl1/atari/ataints.c linux-0.9pl2/atari/ataints.c
  537. *** linux-0.9pl1/atari/ataints.c    Wed Jun 29 15:42:15 1994
  538. --- linux-0.9pl2/atari/ataints.c    Fri Aug  5 12:46:48 1994
  539. ***************
  540. *** 13,18 ****
  541. --- 13,21 ----
  542.    *  the normal way. Additionally, all vectors >= 48 are initialized to call
  543.    *  trap() instead of inthandler(). This must be changed here, too.
  544.    *
  545. +  * ++andreas: Use software end-of-interrupt mode so that interrupts
  546. +  *  with higher priorities are not blocked.
  547. +  *
  548.    * This file is subject to the terms and conditions of the GNU General Public
  549.    * License.  See the file README.legal in the main directory of this archive
  550.    * for more details.
  551. ***************
  552. *** 32,37 ****
  553. --- 35,43 ----
  554.   #include <linux/atari_stdma.h>
  555.   #include <linux/bootinfo.h>
  556.   
  557. + /* isrfunc variables for atari interrupt sources */
  558. + static isr_node_t *ata_lists[NUM_ATARI_SOURCES];
  559.   /*
  560.    * void atari_init_INTS (void)
  561.    *
  562. ***************
  563. *** 60,66 ****
  564.        * non-autovector ints, so we they should jump to the inthandler!
  565.        */
  566.   
  567. !     for( i = 48; i < 112; ++i )
  568.           vectors[i] = inthandler;
  569.   
  570.       /* All ints are initialized to do nothing by the device independant code
  571. --- 66,72 ----
  572.        * non-autovector ints, so we they should jump to the inthandler!
  573.        */
  574.   
  575. !     for( i = 64; i < 112; ++i )
  576.           vectors[i] = inthandler;
  577.   
  578.       /* All ints are initialized to do nothing by the device independant code
  579. ***************
  580. *** 68,81 ****
  581.       
  582.       /* Initialize the MFP(s) */
  583.       
  584. !     mfp.vec_adr  = 0x40;    /* Automatic EOI-Mode */
  585.       mfp.int_en_a =            /* turn off MFP-Ints */
  586.       mfp.int_en_b = 0x00;
  587.       mfp.int_mk_a =            /* no Masking */
  588.       mfp.int_mk_b = 0xff;
  589.   
  590.       if (boot_info.bi_atari.model == ATARI_TT) {
  591. !         tt_mfp.vec_adr  = 0x50;        /* Automatic EOI-Mode */
  592.           tt_mfp.int_en_a =            /* turn off MFP-Ints */
  593.           tt_mfp.int_en_b = 0x00;
  594.           tt_mfp.int_mk_a =            /* no Masking */
  595. --- 74,87 ----
  596.       
  597.       /* Initialize the MFP(s) */
  598.       
  599. !     mfp.vec_adr  = 0x48;    /* Software EOI-Mode */
  600.       mfp.int_en_a =            /* turn off MFP-Ints */
  601.       mfp.int_en_b = 0x00;
  602.       mfp.int_mk_a =            /* no Masking */
  603.       mfp.int_mk_b = 0xff;
  604.   
  605.       if (boot_info.bi_atari.model == ATARI_TT) {
  606. !         tt_mfp.vec_adr  = 0x58;        /* Software EOI-Mode */
  607.           tt_mfp.int_en_a =            /* turn off MFP-Ints */
  608.           tt_mfp.int_en_b = 0x00;
  609.           tt_mfp.int_mk_a =            /* no Masking */
  610. ***************
  611. *** 88,93 ****
  612. --- 94,102 ----
  613.                                        * enabled in VME mask
  614.                                        */
  615.           tt_scu.vme_mask = 0x60;        /* enable MFP and SCC ints */
  616. +         /* clear the system configuration byte so that
  617. +            rebooting works */
  618. +         tt_scu.gp_reg1 = 0;
  619.   
  620.           /* Initialize the LM1992 Sound Controller to enable the PSG sound.
  621.            * This is misplaced here, it should be in a atasound_init(),
  622. ***************
  623. *** 104,113 ****
  624.   }
  625.   
  626.   
  627. ! /* dummy mach_add_isr(), we don't need one */
  628.   
  629. ! int atari_add_isr( unsigned long source , isrfunc isr , int pri , void *data )
  630.   
  631.   {
  632. !     return( 0 );
  633.   }
  634. --- 113,187 ----
  635.   }
  636.   
  637.   
  638. ! /*
  639. !  * atari_add_isr : add an interrupt service routine for a particular
  640. !  *           machine specific interrupt source.
  641. !  *           If the addition was successful, it returns 1, otherwise
  642. !  *           it returns 0.  It will fail if another routine is already
  643. !  *           bound into the specified source.
  644. !  *   Note that the "pri" argument is currently unused.
  645. !  */
  646. ! int atari_add_isr (unsigned long source, isrfunc isr, int pri, void *data)
  647. ! {
  648. !   unsigned long atari_source = source & ~IRQ_MACHSPEC;
  649. !   isr_node_t *p;
  650. !   if (atari_source >= NUM_ATARI_SOURCES
  651. !       || (atari_source >= TTMFP_SOURCE_BASE
  652. !       && boot_info.bi_atari.model != ATARI_TT)
  653. !       || (atari_source >= SCC_SOURCE_BASE
  654. !       /* the SCC uses only half of the vectors */
  655. !       && atari_source & 1))
  656. !     {
  657. !       printk ("atari_add_isr: Unknown uservector: %ld\n", atari_source);
  658. !       return 0;
  659. !     }
  660. !   p = new_isr_node();
  661. !   p->isr = isr;
  662. !   p->pri = pri;
  663. !   p->data = data;
  664. !   p->next = NULL;
  665.   
  666. !   insert_isr (&ata_lists[atari_source], p);
  667.   
  668. +   return 1;
  669. + }
  670. + void atari_process_int (int level, struct intframe *fp)
  671.   {
  672. !   ushort sr;
  673. !   int mask;
  674. !   /* Lower the ipl to let interrupts with higher priority come through */
  675. !   asm volatile ("movew sr,%0" : "=dm" (sr));
  676. !   sr -= 0x100;
  677. !   asm volatile ("movew %0,sr" : : "dm" (sr));
  678. !   call_isr_list (ata_lists[level], fp);
  679. !   /* acknowledge the interrupt */
  680. !   mask = ~(1 << (level & 7));
  681. !   switch (level >> 3)
  682. !     {
  683. !     case 0:
  684. !       mfp.int_sv_b = mask;
  685. !       break;
  686. !     case 1:
  687. !       mfp.int_sv_a = mask;
  688. !       break;
  689. !     case 2:
  690. !       tt_mfp.int_sv_b = mask;
  691. !       break;
  692. !     case 3:
  693. !       tt_mfp.int_sv_a = mask;
  694. !       break;
  695. !     case 4:
  696. !     case 5:
  697. !       /* TODO: SCC interrupt acknowledge */
  698. !       break;
  699. !     default:
  700. !       panic ("Unknown user interrupt level %d", level);
  701. !     }
  702.   }
  703. diff -cr --new-file linux-0.9pl1/atari/atakeyb.c linux-0.9pl2/atari/atakeyb.c
  704. *** linux-0.9pl1/atari/atakeyb.c    Wed Jun 29 17:18:24 1994
  705. --- linux-0.9pl2/atari/atakeyb.c    Fri Aug  5 12:46:50 1994
  706. ***************
  707. *** 90,96 ****
  708.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  709.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  710.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  711. ! /* 60-63 */    K_HOLE,    K_F12,    K_F11,    '(',
  712.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  713.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  714.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  715. --- 90,96 ----
  716.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  717.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  718.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  719. ! /* 60-63 */    '<',    K_F12,    K_HELP,    '(',
  720.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  721.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  722.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  723. ***************
  724. *** 123,129 ****
  725.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  726.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  727.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  728. ! /* 60-63 */    K_HOLE,    K_BREAK,    K_SH_MEM,    '(',
  729.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  730.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  731.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  732. --- 123,129 ----
  733.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  734.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  735.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  736. ! /* 60-63 */    '>',    K_BREAK,    K_SH_MEM,    '(',
  737.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  738.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  739.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  740. ***************
  741. *** 156,162 ****
  742.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  743.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  744.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  745. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  746.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  747.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  748.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  749. --- 156,162 ----
  750.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  751.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  752.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  753. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  754.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  755.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  756.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  757. ***************
  758. *** 189,195 ****
  759.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  760.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  761.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  762. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  763.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  764.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  765.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  766. --- 189,195 ----
  767.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  768.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  769.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  770. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  771.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  772.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  773.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  774. ***************
  775. *** 222,228 ****
  776.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  777.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  778.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  779. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_SH_REGS,    '(',
  780.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  781.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  782.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  783. --- 222,228 ----
  784.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  785.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  786.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  787. ! /* 60-63 */    '\\'&0x1f,    K_HOLE,    K_SH_REGS,    '(',
  788.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  789.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  790.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  791. ***************
  792. *** 255,261 ****
  793.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  794.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  795.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  796. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    '(',
  797.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  798.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  799.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  800. --- 255,261 ----
  801.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  802.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  803.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  804. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    '(',
  805.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  806.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  807.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  808. ***************
  809. *** 288,294 ****
  810.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  811.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  812.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  813. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  814.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  815.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  816.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  817. --- 288,294 ----
  818.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  819.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  820.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  821. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  822.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  823.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  824.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  825. ***************
  826. *** 321,327 ****
  827.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  828.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  829.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  830. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  831.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  832.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  833.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  834. --- 321,327 ----
  835.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  836.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  837.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  838. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  839.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  840.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  841.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  842. ***************
  843. *** 354,360 ****
  844.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  845.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  846.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  847. ! /* 60-63 */    K_HOLE,    K_CONS,    K_SH_STAT,    '(',
  848.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_ASC7,
  849.   /* 68-6b */    K_ASC8,    K_ASC9,    K_ASC4,    K_ASC5,
  850.   /* 6c-6f */    K_ASC6,    K_ASC1,    K_ASC2,    K_ASC3,
  851. --- 354,360 ----
  852.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  853.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  854.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  855. ! /* 60-63 */    K(KT_META,'<'),    K_CONS,    K_SH_STAT,    '(',
  856.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_ASC7,
  857.   /* 68-6b */    K_ASC8,    K_ASC9,    K_ASC4,    K_ASC5,
  858.   /* 6c-6f */    K_ASC6,    K_ASC1,    K_ASC2,    K_ASC3,
  859. ***************
  860. *** 387,393 ****
  861.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  862.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  863.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  864. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    '(',
  865.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  866.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  867.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  868. --- 387,393 ----
  869.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  870.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  871.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  872. ! /* 60-63 */    K(KT_META,'>'),    K_HOLE,    K_HELP,    '(',
  873.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  874.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  875.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  876. ***************
  877. *** 420,426 ****
  878.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  879.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  880.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  881. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  882.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  883.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  884.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  885. --- 420,426 ----
  886.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  887.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  888.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  889. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  890.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  891.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  892.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  893. ***************
  894. *** 453,459 ****
  895.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  896.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  897.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  898. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  899.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  900.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  901.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  902. --- 453,459 ----
  903.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  904.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  905.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  906. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  907.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  908.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  909.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  910. ***************
  911. *** 486,492 ****
  912.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  913.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  914.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  915. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    '(',
  916.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  917.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  918.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  919. --- 486,492 ----
  920.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  921.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  922.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  923. ! /* 60-63 */    K(KT_META,'\\'&0x1f),    K_HOLE,    K_HELP,    '(',
  924.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  925.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  926.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  927. ***************
  928. *** 519,525 ****
  929.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  930.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  931.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  932. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    '(',
  933.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  934.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  935.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  936. --- 519,525 ----
  937.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  938.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  939.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  940. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    '(',
  941.   /* 64-67 */    ')',    K_PSLASH,    K_PSTAR,    K_P7,
  942.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  943.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  944. ***************
  945. *** 552,558 ****
  946.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  947.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  948.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  949. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  950.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  951.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  952.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  953. --- 552,558 ----
  954.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  955.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  956.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  957. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  958.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  959.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  960.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  961. ***************
  962. *** 585,591 ****
  963.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  964.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  965.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  966. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  967.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  968.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  969.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  970. --- 585,591 ----
  971.   /* 54-57 */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  972.   /* 58-5b */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  973.   /* 5c-5f */    K_HOLE,    K_HOLE,    K_HOLE,    K_HOLE,
  974. ! /* 60-63 */    K_HOLE,    K_HOLE,    K_HELP,    K_HOLE,
  975.   /* 64-67 */    K_HOLE,    K_PSLASH,    K_PSTAR,    K_P7,
  976.   /* 68-6b */    K_P8,    K_P9,    K_P4,    K_P5,
  977.   /* 6c-6f */    K_P6,    K_P1,    K_P2,    K_P3,
  978. ***************
  979. *** 819,825 ****
  980.   }
  981.   
  982.   #ifdef KEYB_WRITE_INTERRUPT
  983. ! void ikbd_write(char *str, int len)
  984.   {
  985.       u_char acia_stat;
  986.   
  987. --- 819,825 ----
  988.   }
  989.   
  990.   #ifdef KEYB_WRITE_INTERRUPT
  991. ! void ikbd_write(const char *str, int len)
  992.   {
  993.       u_char acia_stat;
  994.   
  995. ***************
  996. *** 830,836 ****
  997.       {
  998.       if (len != 1)
  999.       {
  1000. !         kb_stat.buf = str 1;
  1001.           kb_stat.len = len - 1;
  1002.       }
  1003.       acia.key_data = *str;
  1004. --- 830,836 ----
  1005.       {
  1006.       if (len != 1)
  1007.       {
  1008. !         kb_stat.buf = str + 1;
  1009.           kb_stat.len = len - 1;
  1010.       }
  1011.       acia.key_data = *str;
  1012. ***************
  1013. *** 846,852 ****
  1014.    * is the solution. (I made a feeble attempt in that direction but I
  1015.    * kept it simple for now.)
  1016.    */
  1017. ! void ikbd_write(char *str, int len)
  1018.   {
  1019.       u_char acia_stat;
  1020.   
  1021. --- 846,852 ----
  1022.    * is the solution. (I made a feeble attempt in that direction but I
  1023.    * kept it simple for now.)
  1024.    */
  1025. ! void ikbd_write(const char *str, int len)
  1026.   {
  1027.       u_char acia_stat;
  1028.   
  1029. ***************
  1030. *** 867,873 ****
  1031.   /* Reset (without touching the clock) */
  1032.   void ikbd_reset(void)
  1033.   {
  1034. !     static char cmd[2] = { 0x80, 0x01 };
  1035.       
  1036.       ikbd_write(cmd, 2);
  1037.   
  1038. --- 867,873 ----
  1039.   /* Reset (without touching the clock) */
  1040.   void ikbd_reset(void)
  1041.   {
  1042. !     static const char cmd[2] = { 0x80, 0x01 };
  1043.       
  1044.       ikbd_write(cmd, 2);
  1045.   
  1046. ***************
  1047. *** 886,892 ****
  1048.   /* Set relative mouse position reporting */
  1049.   void ikbd_mouse_rel_pos(void)
  1050.   {
  1051. !     static char cmd[1] = { 0x08 };
  1052.   
  1053.       ikbd_write(cmd, 1);
  1054.   }
  1055. --- 886,892 ----
  1056.   /* Set relative mouse position reporting */
  1057.   void ikbd_mouse_rel_pos(void)
  1058.   {
  1059. !     static const char cmd[1] = { 0x08 };
  1060.   
  1061.       ikbd_write(cmd, 1);
  1062.   }
  1063. ***************
  1064. *** 926,932 ****
  1065.   /* Interrogate mouse position */
  1066.   void ikbd_mouse_pos_get(int *x, int *y)
  1067.   {
  1068. !     static char cmd[1] = { 0x0D };
  1069.   
  1070.       ikbd_write(cmd, 1);
  1071.   
  1072. --- 926,932 ----
  1073.   /* Interrogate mouse position */
  1074.   void ikbd_mouse_pos_get(int *x, int *y)
  1075.   {
  1076. !     static const char cmd[1] = { 0x0D };
  1077.   
  1078.       ikbd_write(cmd, 1);
  1079.   
  1080. ***************
  1081. *** 944,950 ****
  1082.   /* Set Y=0 at bottom */
  1083.   void ikbd_mouse_y0_bot(void)
  1084.   {
  1085. !     static char cmd[1] = { 0x0F };
  1086.   
  1087.       ikbd_write(cmd, 1);
  1088.   }
  1089. --- 944,950 ----
  1090.   /* Set Y=0 at bottom */
  1091.   void ikbd_mouse_y0_bot(void)
  1092.   {
  1093. !     static const char cmd[1] = { 0x0F };
  1094.   
  1095.       ikbd_write(cmd, 1);
  1096.   }
  1097. ***************
  1098. *** 952,958 ****
  1099.   /* Set Y=0 at top */
  1100.   void ikbd_mouse_y0_top(void)
  1101.   {
  1102. !     static char cmd[1] = { 0x10 };
  1103.   
  1104.       ikbd_write(cmd, 1);
  1105.   }
  1106. --- 952,958 ----
  1107.   /* Set Y=0 at top */
  1108.   void ikbd_mouse_y0_top(void)
  1109.   {
  1110. !     static const char cmd[1] = { 0x10 };
  1111.   
  1112.       ikbd_write(cmd, 1);
  1113.   }
  1114. ***************
  1115. *** 960,966 ****
  1116.   /* Resume */
  1117.   void ikbd_resume(void)
  1118.   {
  1119. !     static char cmd[1] = { 0x11 };
  1120.   
  1121.       ikbd_write(cmd, 1);
  1122.   }
  1123. --- 960,966 ----
  1124.   /* Resume */
  1125.   void ikbd_resume(void)
  1126.   {
  1127. !     static const char cmd[1] = { 0x11 };
  1128.   
  1129.       ikbd_write(cmd, 1);
  1130.   }
  1131. ***************
  1132. *** 968,974 ****
  1133.   /* Disable mouse */
  1134.   void ikbd_mouse_disable(void)
  1135.   {
  1136. !     static char cmd[1] = { 0x12 };
  1137.   
  1138.       ikbd_write(cmd, 1);
  1139.   }
  1140. --- 968,974 ----
  1141.   /* Disable mouse */
  1142.   void ikbd_mouse_disable(void)
  1143.   {
  1144. !     static const char cmd[1] = { 0x12 };
  1145.   
  1146.       ikbd_write(cmd, 1);
  1147.   }
  1148. ***************
  1149. *** 976,982 ****
  1150.   /* Pause output */
  1151.   void ikbd_pause(void)
  1152.   {
  1153. !     static char cmd[1] = { 0x13 };
  1154.   
  1155.       ikbd_write(cmd, 1);
  1156.   }
  1157. --- 976,982 ----
  1158.   /* Pause output */
  1159.   void ikbd_pause(void)
  1160.   {
  1161. !     static const char cmd[1] = { 0x13 };
  1162.   
  1163.       ikbd_write(cmd, 1);
  1164.   }
  1165. ***************
  1166. *** 984,990 ****
  1167.   /* Set joystick event reporting */
  1168.   void ikbd_joystick_event_on(void)
  1169.   {
  1170. !     static char cmd[1] = { 0x14 };
  1171.   
  1172.       ikbd_write(cmd, 1);
  1173.   }
  1174. --- 984,990 ----
  1175.   /* Set joystick event reporting */
  1176.   void ikbd_joystick_event_on(void)
  1177.   {
  1178. !     static const char cmd[1] = { 0x14 };
  1179.   
  1180.       ikbd_write(cmd, 1);
  1181.   }
  1182. ***************
  1183. *** 992,998 ****
  1184.   /* Set joystick interrogation mode */
  1185.   void ikbd_joystick_event_off(void)
  1186.   {
  1187. !     static char cmd[1] = { 0x15 };
  1188.   
  1189.       ikbd_write(cmd, 1);
  1190.   }
  1191. --- 992,998 ----
  1192.   /* Set joystick interrogation mode */
  1193.   void ikbd_joystick_event_off(void)
  1194.   {
  1195. !     static const char cmd[1] = { 0x15 };
  1196.   
  1197.       ikbd_write(cmd, 1);
  1198.   }
  1199. ***************
  1200. *** 1000,1006 ****
  1201.   /* Joystick interrogation */
  1202.   void ikbd_joystick_get_state(void)
  1203.   {
  1204. !     static char cmd[1] = { 0x16 };
  1205.   
  1206.       ikbd_write(cmd, 1);
  1207.   }
  1208. --- 1000,1006 ----
  1209.   /* Joystick interrogation */
  1210.   void ikbd_joystick_get_state(void)
  1211.   {
  1212. !     static const char cmd[1] = { 0x16 };
  1213.   
  1214.       ikbd_write(cmd, 1);
  1215.   }
  1216. ***************
  1217. *** 1010,1016 ****
  1218.   /* Set joystick monitoring */
  1219.   void ikbd_joystick_monitor(int rate)
  1220.   {
  1221. !     static char cmd[2] = { 0x17, rate };
  1222.   
  1223.       ikbd_write(cmd, 2);
  1224.   
  1225. --- 1010,1016 ----
  1226.   /* Set joystick monitoring */
  1227.   void ikbd_joystick_monitor(int rate)
  1228.   {
  1229. !     static const char cmd[2] = { 0x17, rate };
  1230.   
  1231.       ikbd_write(cmd, 2);
  1232.   
  1233. ***************
  1234. *** 1023,1029 ****
  1235.   /* Disable joysticks */
  1236.   void ikbd_joystick_disable(void)
  1237.   {
  1238. !     static char cmd[1] = { 0x1A };
  1239.   
  1240.       ikbd_write(cmd, 1);
  1241.   }
  1242. --- 1023,1029 ----
  1243.   /* Disable joysticks */
  1244.   void ikbd_joystick_disable(void)
  1245.   {
  1246. !     static const char cmd[1] = { 0x1A };
  1247.   
  1248.       ikbd_write(cmd, 1);
  1249.   }
  1250. ***************
  1251. *** 1039,1045 ****
  1252.   /* Interrogate time-of-day clock */
  1253.   void ikbd_clock_get(int *year, int *month, int *day, int *hour, int *minute, int second)
  1254.   {
  1255. !     static char cmd[1] = { 0x1C };
  1256.   
  1257.       ikbd_write(cmd, 1);
  1258.   }
  1259. --- 1039,1045 ----
  1260.   /* Interrogate time-of-day clock */
  1261.   void ikbd_clock_get(int *year, int *month, int *day, int *hour, int *minute, int second)
  1262.   {
  1263. !     static const char cmd[1] = { 0x1C };
  1264.   
  1265.       ikbd_write(cmd, 1);
  1266.   }
  1267. diff -cr --new-file linux-0.9pl1/atari/config.c linux-0.9pl2/atari/config.c
  1268. *** linux-0.9pl1/atari/config.c    Wed Jun 29 16:02:22 1994
  1269. --- linux-0.9pl2/atari/config.c    Fri Aug  5 12:46:51 1994
  1270. ***************
  1271. *** 35,79 ****
  1272.   #include <asm/system.h>
  1273.   
  1274.   
  1275. ! extern long    time_adj;        /* from kernel/sched.c */
  1276.   
  1277.   
  1278. ! void atari_sched_init (isrfunc timer_routine)
  1279.   {
  1280. !     /* set Timer A data Register */
  1281. !     mfp.tim_dt_a=INT_TICKS;
  1282.   
  1283. !     /* install interrupt service routine for MFP Timer A */
  1284. !     add_isr (IRQ_MFP_TIMA, timer_routine, 0, NULL); 
  1285. !     /* start timer A, div = 1:100 */
  1286. !     mfp.tim_ct_a = 0x06; 
  1287. !     /* enable timer A Interrupt */   
  1288. !     mfp.int_en_a |= 0x20;
  1289. !     /* The excact frequency of our timer is 2.4576 MHz / 100 / 246 =
  1290. !      * 99.90243902 Hz. This gives a difference of 9.76954 us to real time
  1291. !      * per clock tick. time_adj is in us scaled by 2^24, thus it should
  1292. !      * be 9.76954 * 2^24 = 163905683
  1293. !      */
  1294. !     time_adj = 163905683;
  1295.   }
  1296.   
  1297.   
  1298.   unsigned long atari_gettimeoffset (void)
  1299.   {
  1300. !     unsigned long ticks, flags;
  1301.   
  1302. !     save_flags(flags);
  1303. !     cli();
  1304.   
  1305. !     ticks = (unsigned long)mfp.tim_dt_a;
  1306. !     restore_flags(flags);
  1307. !     
  1308. !     ticks = (INT_TICKS-1) - ticks;
  1309. !     ticks = ticks * 10000L / INT_TICKS;
  1310. !     
  1311. !     return ticks;
  1312.   
  1313.   }
  1314.   
  1315.   
  1316. --- 35,93 ----
  1317.   #include <asm/system.h>
  1318.   
  1319.   
  1320. ! /* ++andreas: timer interrupt fixed to have perfect 100 Hz */
  1321.   
  1322. + static int timer_c_high;
  1323.   
  1324. ! /* Intermediate timer routine to allow for INT_TICKS to be bigger
  1325. !    than 256. */
  1326. ! static void atari_timer_routine (struct intframe *fp, void *data)
  1327.   {
  1328. !   if (--timer_c_high < 0)
  1329. !     {
  1330. !       isrfunc timer_routine = (isrfunc) data;
  1331. !       timer_c_high = 1;
  1332. !       timer_routine (fp, NULL);
  1333. !     }
  1334. ! }
  1335.   
  1336. ! void atari_sched_init (isrfunc timer_routine)
  1337. ! {
  1338. !   /* set Timer C data Register */
  1339. !   mfp.tim_dt_c = INT_TICKS / 2;
  1340. !   timer_c_high = 0;
  1341. !   /* install interrupt service routine for MFP Timer C */
  1342. !   add_isr (IRQ_MFP_TIMC, atari_timer_routine, 0, timer_routine); 
  1343. !   /* start timer C, div = 1:64 */
  1344. !   mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x50; 
  1345. !   /* enable timer C Interrupt */   
  1346. !   mfp.int_en_b |= 0x20;
  1347.   }
  1348.   
  1349. + /* ++andreas: gettimeoffset fixed to check for pending interrupt */
  1350.   
  1351. + #define TICK_SIZE 5000
  1352. + /* This is always executed with interrupts disabled.  */
  1353.   unsigned long atari_gettimeoffset (void)
  1354.   {
  1355. !   unsigned long ticks, offset = 0;
  1356.   
  1357. !   /* read MFP timer C current value */
  1358. !   ticks = mfp.tim_dt_c;
  1359. !   /* The probability of underflow is less than 2% */
  1360. !   if (ticks > INT_TICKS / 2 - INT_TICKS / 100)
  1361. !     /* Check for pending timer interrupt */
  1362. !     if (mfp.int_pn_b & (1 << 5))
  1363. !       offset = TICK_SIZE;
  1364. !   if (timer_c_high)
  1365. !     ticks += INT_TICKS / 2;
  1366.   
  1367. !   ticks = INT_TICKS - ticks;
  1368. !   ticks = ticks * 10000L / INT_TICKS;
  1369.   
  1370. +   return ticks + offset;
  1371.   }
  1372.   
  1373.   
  1374. ***************
  1375. *** 113,119 ****
  1376.   
  1377.           /* Adjust values (let the setup valid for TOS) */
  1378.           time->mon--;
  1379. !         time->year += 70;
  1380.   
  1381.           ctrl = RTC_READ(RTC_CONTROL); 
  1382.   
  1383. --- 127,133 ----
  1384.   
  1385.           /* Adjust values (let the setup valid for TOS) */
  1386.           time->mon--;
  1387. !         time->year += 68;
  1388.   
  1389.           ctrl = RTC_READ(RTC_CONTROL); 
  1390.   
  1391. diff -cr --new-file linux-0.9pl1/atari/stram.c linux-0.9pl2/atari/stram.c
  1392. *** linux-0.9pl1/atari/stram.c    Wed Dec 31 19:00:00 1969
  1393. --- linux-0.9pl2/atari/stram.c    Fri Aug  5 12:46:52 1994
  1394. ***************
  1395. *** 0 ****
  1396. --- 1,141 ----
  1397. + #include <linux/types.h>
  1398. + #include <linux/kernel.h>
  1399. + #include <linux/bootinfo.h>
  1400. + #include <linux/atarihw.h>
  1401. + struct stram_desc
  1402. +   {
  1403. +     unsigned first:1;
  1404. +     unsigned last:1;
  1405. +     unsigned alloced:1;
  1406. +     unsigned length:24;
  1407. +   };
  1408. + #define DP(ptr) ((struct stram_desc *) (ptr))
  1409. + static unsigned long stramsize;
  1410. + static unsigned long stramaddr;
  1411. + void
  1412. + atari_stram_init (void)
  1413. + {
  1414. +   struct stram_desc *dp;
  1415. +   stramaddr = boot_info.bi_atari.stram_start;
  1416. +   stramsize = boot_info.bi_atari.stram_size;
  1417. +   /* initialize start boundary */
  1418. +   dp = DP (stramaddr);
  1419. +   dp->first = 1;
  1420. +   dp->alloced = 0;
  1421. +   dp->length = stramsize - 2 * sizeof (*dp);
  1422. +   /* initialize end boundary */
  1423. +   dp = DP (stramaddr + stramsize) - 1;
  1424. +   dp->last = 1;
  1425. +   dp->alloced = 0;
  1426. +   dp->length = stramsize - 2 * sizeof (*dp);
  1427. + #ifdef DEBUG
  1428. +   printk ("stram end boundary is %p, length is %d\n", dp,
  1429. +       dp->length);
  1430. + #endif
  1431. + }
  1432. + void *
  1433. + atari_stram_alloc (long size)
  1434. + {
  1435. +   /* last chunk */
  1436. +   struct stram_desc *dp;
  1437. +   void *ptr;
  1438. +   /* round off */
  1439. +   size = (size + 3) & ~3;
  1440. + #ifdef DEBUG
  1441. +   printk ("stram_alloc: allocate %ld bytes\n", size);
  1442. + #endif
  1443. +   /*
  1444. +    * get pointer to descriptor for last chunk by 
  1445. +    * going backwards from end chunk
  1446. +    */
  1447. +   dp = DP (stramaddr + stramsize) - 1;
  1448. +   dp = DP ((unsigned long) dp - dp->length) - 1;
  1449. +   while ((dp->alloced || dp->length < size) && !dp->first)
  1450. +     dp = DP ((unsigned long) dp - dp[-1].length) - 2;
  1451. +   if (dp->alloced || dp->length < size)
  1452. +     {
  1453. +       printk ("no stram available for %ld allocation\n", size);
  1454. +       return NULL;
  1455. +     }
  1456. +   if (dp->length < size + 2 * sizeof (*dp))
  1457. +     {
  1458. +       /* length too small to split; allocate the whole thing */
  1459. +       dp->alloced = 1;
  1460. +       ptr = (void *) (dp + 1);
  1461. +       dp = DP ((unsigned long) ptr + dp->length);
  1462. +       dp->alloced = 1;
  1463. + #ifdef DEBUG
  1464. +       printk ("stram_alloc: no split\n");
  1465. + #endif
  1466. +     }
  1467. +   else
  1468. +     {
  1469. +       /* split the extent; use the end part */
  1470. +       long newsize = dp->length - (2 * sizeof (*dp) + size);
  1471. + #ifdef DEBUG
  1472. +       printk ("stram_alloc: splitting %d to %ld\n", dp->length,
  1473. +           newsize);
  1474. + #endif
  1475. +       dp->length = newsize;
  1476. +       dp = DP ((unsigned long) (dp + 1) + newsize);
  1477. +       dp->first = dp->last = 0;
  1478. +       dp->alloced = 0;
  1479. +       dp->length = newsize;
  1480. +       dp++;
  1481. +       dp->first = dp->last = 0;
  1482. +       dp->alloced = 1;
  1483. +       dp->length = size;
  1484. +       ptr = (void *) (dp + 1);
  1485. +       dp = DP ((unsigned long) ptr + size);
  1486. +       dp->alloced = 1;
  1487. +       dp->length = size;
  1488. +     }
  1489. + #ifdef DEBUG
  1490. +   printk ("stram_alloc: returning %p\n", ptr);
  1491. + #endif
  1492. +   return ptr;
  1493. + }
  1494. + void 
  1495. + atari_stram_free (void *ptr)
  1496. + {
  1497. +   struct stram_desc *sdp = DP (ptr) - 1, *dp2;
  1498. +   struct stram_desc *edp = DP ((unsigned long) ptr + sdp->length);
  1499. +   /* deallocate the chunk */
  1500. +   sdp->alloced = edp->alloced = 0;
  1501. +   /* check if we should merge with the previous chunk */
  1502. +   if (!sdp->first && !sdp[-1].alloced)
  1503. +     {
  1504. +       dp2 = DP ((unsigned long) sdp - sdp[-1].length) - 2;
  1505. +       dp2->length += sdp->length + 2 * sizeof (*sdp);
  1506. +       edp->length = dp2->length;
  1507. +       sdp = dp2;
  1508. +     }
  1509. +   /* check if we should merge with the following chunk */
  1510. +   if (!edp->last && !edp[1].alloced)
  1511. +     {
  1512. +       dp2 = DP ((unsigned long) edp + edp[1].length) + 2;
  1513. +       dp2->length += edp->length + 2 * sizeof (*sdp);
  1514. +       sdp->length = dp2->length;
  1515. +       edp = dp2;
  1516. +     }
  1517. + }
  1518. diff -cr --new-file linux-0.9pl1/config.in linux-0.9pl2/config.in
  1519. *** linux-0.9pl1/config.in    Tue Jul 26 22:15:18 1994
  1520. --- linux-0.9pl2/config.in    Fri Aug  5 12:51:33 1994
  1521. ***************
  1522. *** 53,60 ****
  1523.   bool 'GVP Series II WD33C93A support' CONFIG_GVP11_SCSI y
  1524.   fi
  1525.   if [ "$CONFIG_ATARI" = "y" ]
  1526. ! bool 'Atari TT native SCSI support' CONFIG_ATARI_TT_SCSI y
  1527. ! bool 'Atari Falcon native SCSI support' CONFIG_ATARI_FALCON_SCSI y
  1528.   fi
  1529.   fi
  1530.   *
  1531. --- 53,59 ----
  1532.   bool 'GVP Series II WD33C93A support' CONFIG_GVP11_SCSI y
  1533.   fi
  1534.   if [ "$CONFIG_ATARI" = "y" ]
  1535. ! bool 'Atari native SCSI support' CONFIG_ATARI_SCSI y
  1536.   fi
  1537.   fi
  1538.   *
  1539. diff -cr --new-file linux-0.9pl1/drivers/block/ataflop.c linux-0.9pl2/drivers/block/ataflop.c
  1540. *** linux-0.9pl1/drivers/block/ataflop.c    Wed Jun 29 16:25:43 1994
  1541. --- linux-0.9pl2/drivers/block/ataflop.c    Fri Aug  5 12:46:53 1994
  1542. ***************
  1543. *** 82,88 ****
  1544.   
  1545.   /* track buffer */
  1546.   static int savedtrack = -1;
  1547. ! static unsigned char trackdata[512];
  1548.   
  1549.   /*
  1550.    * These are global variables, as that's the easiest way to give
  1551. --- 82,88 ----
  1552.   
  1553.   /* track buffer */
  1554.   static int savedtrack = -1;
  1555. ! unsigned char *trackdata; /* allocated by atari_stram_alloc */
  1556.   
  1557.   /*
  1558.    * These are global variables, as that's the easiest way to give
  1559. ***************
  1560. *** 140,171 ****
  1561.   static int on_attempts;
  1562.   #endif
  1563.   
  1564. ! static void wait_func(void)
  1565. !  {
  1566. !   int i;
  1567. !   for(i=0;i<30;i++)
  1568. !    i=i;
  1569. !  }  
  1570. ! static void fd_select (int drive,unsigned short tr)
  1571.   {
  1572. -   int oldtr;
  1573.     unsigned long flags;
  1574.     unsigned char tmp;
  1575.     
  1576.     if (drive == selected)
  1577.         return;
  1578. -   oldtr=tr/2;
  1579.     selected = drive;
  1580.   
  1581.     save_flags(flags);
  1582.     cli();
  1583.   
  1584. !   if(oldtr*2==tr)
  1585.      {
  1586.       sound_ym.rd_data_reg_sel=14;    /* Select PSG Port A */
  1587.       tmp = sound_ym.rd_data_reg_sel;
  1588. !     sound_ym.wd_data = tmp & ~2;    /* Select Side 0 and Drive A */
  1589.      }
  1590.     else
  1591.      {
  1592. --- 140,162 ----
  1593.   static int on_attempts;
  1594.   #endif
  1595.   
  1596. ! static void fd_select (int drive, int side)
  1597.   {
  1598.     unsigned long flags;
  1599.     unsigned char tmp;
  1600.     
  1601.     if (drive == selected)
  1602.         return;
  1603.     selected = drive;
  1604.   
  1605.     save_flags(flags);
  1606.     cli();
  1607.   
  1608. !   if (side == 0)
  1609.      {
  1610.       sound_ym.rd_data_reg_sel=14;    /* Select PSG Port A */
  1611.       tmp = sound_ym.rd_data_reg_sel;
  1612. !     sound_ym.wd_data = (tmp & ~2) | 1;    /* Select Side 0 and Drive A */
  1613.      }
  1614.     else
  1615.      {
  1616. ***************
  1617. *** 233,243 ****
  1618.     dma_wd.dma_mode_status=FDCSELREG_DTA;
  1619.     nop();
  1620.     dma_wd.fdc_acces_seccount=track;
  1621. !   wait_func();
  1622.     dma_wd.dma_mode_status=FDCSELREG_STP;
  1623.     nop();
  1624.     dma_wd.fdc_acces_seccount=FDCCMD_SEEK | FDCCMDADD_V ;
  1625. !   wait_func();
  1626.     fd_nobusy();
  1627.       
  1628.       return 1;
  1629. --- 224,234 ----
  1630.     dma_wd.dma_mode_status=FDCSELREG_DTA;
  1631.     nop();
  1632.     dma_wd.fdc_acces_seccount=track;
  1633. !   udelay (1);
  1634.     dma_wd.dma_mode_status=FDCSELREG_STP;
  1635.     nop();
  1636.     dma_wd.fdc_acces_seccount=FDCCMD_SEEK | FDCCMDADD_V ;
  1637. !   udelay (1);
  1638.     fd_nobusy();
  1639.       
  1640.       return 1;
  1641. ***************
  1642. *** 262,277 ****
  1643.   static void atari_write(int dr, unsigned short tr, unsigned short sec)
  1644.   {
  1645.     unsigned long phys_secbuf,flags;
  1646. -   int i;
  1647.       
  1648.     sec=sec+1;
  1649.     
  1650. !   phys_secbuf=VTOP((unsigned long)trackdata); /* DMA knows PhysAdr only ! */
  1651.     
  1652.     save_flags(flags);  
  1653.     cli();
  1654.     
  1655. !   fd_select(dr,tr);
  1656.     
  1657.     tr=tr/2;
  1658.   
  1659. --- 253,267 ----
  1660.   static void atari_write(int dr, unsigned short tr, unsigned short sec)
  1661.   {
  1662.     unsigned long phys_secbuf,flags;
  1663.       
  1664.     sec=sec+1;
  1665.     
  1666. !   phys_secbuf = (unsigned long) trackdata;
  1667.     
  1668.     save_flags(flags);  
  1669.     cli();
  1670.     
  1671. !   fd_select (dr, tr & 1);
  1672.     
  1673.     tr=tr/2;
  1674.   
  1675. ***************
  1676. *** 294,323 ****
  1677.   
  1678.     /* Transmit only 1 Sector */
  1679.     dma_wd.fdc_acces_seccount=0x01;
  1680. !   wait_func();  
  1681.     
  1682.     
  1683.     dma_wd.dma_mode_status=FDCSELREG_SEC | 0x100 ;
  1684.     nop();
  1685.     dma_wd.fdc_acces_seccount=sec;   
  1686. !   wait_func();
  1687.     
  1688.     /* Start Write */
  1689.     dma_wd.dma_mode_status=FDCSELREG_STP | 0x100 ;
  1690.     nop();
  1691.     dma_wd.fdc_acces_seccount=FDCCMD_WRSEC ;
  1692. !   wait_func();;      
  1693.     
  1694.     fd_nobusy();  /* Wait for IRQ 5 */
  1695.     
  1696.     restore_flags(flags);
  1697.     
  1698.     fd_deselect(dr);
  1699. !   
  1700. !   for(i=0;i<20000;i++)
  1701. !    {
  1702. !     i=i;
  1703. !    }
  1704.    }
  1705.   
  1706.   /*==========================================================================
  1707. --- 284,310 ----
  1708.   
  1709.     /* Transmit only 1 Sector */
  1710.     dma_wd.fdc_acces_seccount=0x01;
  1711. !   udelay (1);  
  1712.     
  1713.     
  1714.     dma_wd.dma_mode_status=FDCSELREG_SEC | 0x100 ;
  1715.     nop();
  1716.     dma_wd.fdc_acces_seccount=sec;   
  1717. !   udelay (1);
  1718.     
  1719.     /* Start Write */
  1720.     dma_wd.dma_mode_status=FDCSELREG_STP | 0x100 ;
  1721.     nop();
  1722.     dma_wd.fdc_acces_seccount=FDCCMD_WRSEC ;
  1723. !   udelay (1);
  1724.     
  1725.     fd_nobusy();  /* Wait for IRQ 5 */
  1726.     
  1727.     restore_flags(flags);
  1728.     
  1729.     fd_deselect(dr);
  1730. !   udelay (10);
  1731.    }
  1732.   
  1733.   /*==========================================================================
  1734. ***************
  1735. *** 327,340 ****
  1736.   {
  1737.     unsigned long phys_secbuf,flags;
  1738.       
  1739. !   phys_secbuf=VTOP((unsigned long)trackdata);
  1740.     
  1741.     sec=sec+1;
  1742.     
  1743.     save_flags(flags);  
  1744.     cli();
  1745.     
  1746. !   fd_select(dr,tr);
  1747.     
  1748.     tr=tr/2;
  1749.     
  1750. --- 314,327 ----
  1751.   {
  1752.     unsigned long phys_secbuf,flags;
  1753.       
  1754. !   phys_secbuf = (unsigned long) trackdata;
  1755.     
  1756.     sec=sec+1;
  1757.     
  1758.     save_flags(flags);  
  1759.     cli();
  1760.     
  1761. !   fd_select (dr, tr & 1);
  1762.     
  1763.     tr=tr/2;
  1764.     
  1765. ***************
  1766. *** 356,373 ****
  1767.     dma_wd.dma_mode_status=0x90;  
  1768.     /* Transmit only 1 Sector */
  1769.     dma_wd.fdc_acces_seccount=0x01;
  1770. !   wait_func();
  1771.     
  1772.     dma_wd.dma_mode_status=FDCSELREG_SEC;
  1773.     nop();
  1774.     dma_wd.fdc_acces_seccount=sec;   
  1775. !   wait_func();
  1776.     
  1777.     /* Start READ */
  1778.     dma_wd.dma_mode_status=FDCSELREG_STP;
  1779.     nop();
  1780.     dma_wd.fdc_acces_seccount=FDCCMD_RDSEC ;
  1781. !   wait_func();
  1782.       
  1783.     fd_nobusy();  /* Wait for IRQ 5 */
  1784.     
  1785. --- 343,360 ----
  1786.     dma_wd.dma_mode_status=0x90;  
  1787.     /* Transmit only 1 Sector */
  1788.     dma_wd.fdc_acces_seccount=0x01;
  1789. !   udelay (1);
  1790.     
  1791.     dma_wd.dma_mode_status=FDCSELREG_SEC;
  1792.     nop();
  1793.     dma_wd.fdc_acces_seccount=sec;   
  1794. !   udelay (1);
  1795.     
  1796.     /* Start READ */
  1797.     dma_wd.dma_mode_status=FDCSELREG_STP;
  1798.     nop();
  1799.     dma_wd.fdc_acces_seccount=FDCCMD_RDSEC ;
  1800. !   udelay (1);
  1801.       
  1802.     fd_nobusy();  /* Wait for IRQ 5 */
  1803.     
  1804. ***************
  1805. *** 537,544 ****
  1806. --- 524,533 ----
  1807.   
  1808.   #ifdef CONFIG_FLOPPY_DD_ONLY
  1809.       unit[drive].type = &drive_types[1]; /* DD */
  1810. +     dma_wd.fdc_speed = 0;
  1811.   #else
  1812.       unit[drive].type = &drive_types[0]; /* HD */
  1813. +     dma_wd.fdc_speed = 3;
  1814.   #endif
  1815.   
  1816.       unit[drive].dtype = &data_types[0]; /* only one type */
  1817. ***************
  1818. *** 634,639 ****
  1819. --- 623,631 ----
  1820.     }
  1821.     /* initialize variables */
  1822.     selected = -1;
  1823. +   /* memory returned by atari_stram_alloc is identity mapped */
  1824. +   trackdata = atari_stram_alloc (512);
  1825.   
  1826.     for (i = 0; i < FD_MAX_UNITS; i++) {
  1827.         unit[i].track = -1;
  1828. diff -cr --new-file linux-0.9pl1/drivers/char/Makefile linux-0.9pl2/drivers/char/Makefile
  1829. *** linux-0.9pl1/drivers/char/Makefile    Wed Jun 29 17:07:26 1994
  1830. --- linux-0.9pl2/drivers/char/Makefile    Sat Aug  6 20:04:11 1994
  1831. ***************
  1832. *** 1,4 ****
  1833. ! # Makefile for 680x0 Linux chr_drv source directory
  1834.   #
  1835.   # Copyright 1993 by Hamish Macdonald
  1836.   #
  1837. --- 1,4 ----
  1838. ! # Makefile for 680x0 Linux drivers/char source directory
  1839.   #
  1840.   # Copyright 1993 by Hamish Macdonald
  1841.   #
  1842. ***************
  1843. *** 9,16 ****
  1844.   include ../../.config
  1845.   include ../../MakeVars
  1846.   
  1847. ! OBJS    = tty_io.o console.o keyboard.o tty_ioctl.o pty.o vt.o mem.o
  1848. ! SRCS    = tty_io.c console.c keyboard.c tty_ioctl.c pty.c vt.c mem.c
  1849.   
  1850.   ifdef CONFIG_AMIGAMOUSE
  1851.   M = y
  1852. --- 9,16 ----
  1853.   include ../../.config
  1854.   include ../../MakeVars
  1855.   
  1856. ! OBJS    = tty_io.o console.o keyboard.o tty_ioctl.o pty.o vt.o mem.o serial.o
  1857. ! SRCS    = tty_io.c console.c keyboard.c tty_ioctl.c pty.c vt.c mem.c serial.c
  1858.   
  1859.   ifdef CONFIG_AMIGAMOUSE
  1860.   M = y
  1861. ***************
  1862. *** 68,78 ****
  1863.   endif
  1864.   
  1865.   ifdef CONFIG_ATARI
  1866. ! OBJS := $(OBJS) atari_serial.o atari_MFPser.o atari_SCC.o
  1867. ! SRCS := $(SRCS) atari_serial.c atari_MFPser.c atari_SCC.c
  1868. ! else
  1869. ! OBJS := $(OBJS) serial.o
  1870. ! SRCS := $(SRCS) serial.c
  1871.   endif
  1872.   
  1873.   all: char.a
  1874. --- 68,80 ----
  1875.   endif
  1876.   
  1877.   ifdef CONFIG_ATARI
  1878. ! OBJS := $(OBJS) atari_MFPser.o atari_SCC.o
  1879. ! SRCS := $(SRCS) atari_MFPser.c atari_SCC.c
  1880. ! endif
  1881. ! ifdef CONFIG_AMIGA
  1882. ! OBJS := $(OBJS) amiga_ser.o
  1883. ! SRCS := $(SRCS) amiga_ser.c
  1884.   endif
  1885.   
  1886.   all: char.a
  1887. diff -cr --new-file linux-0.9pl1/drivers/char/amiga_ser.c linux-0.9pl2/drivers/char/amiga_ser.c
  1888. *** linux-0.9pl1/drivers/char/amiga_ser.c    Wed Dec 31 19:00:00 1969
  1889. --- linux-0.9pl2/drivers/char/amiga_ser.c    Mon Aug  8 20:32:38 1994
  1890. ***************
  1891. *** 0 ****
  1892. --- 1,364 ----
  1893. + /*
  1894. +  * drivers/char/amiga_ser.c: Amiga built-in serial port driver.
  1895. +  *
  1896. +  * Copyright 1994 Roman Hodek, 1994 Hamish Macdonald
  1897. +  *       Based on the Atari MFP driver by Roman Hodek
  1898. +  * 
  1899. +  * This file is subject to the terms and conditions of the GNU General Public
  1900. +  * License.  See the file README.legal in the main directory of this archive
  1901. +  * for more details.
  1902. +  *
  1903. +  */
  1904. + /*
  1905. +  * This file implements the driver for the Amiga built-in serial port.
  1906. +  */
  1907. + #include <linux/types.h>
  1908. + #include <linux/sched.h>
  1909. + #include <linux/interrupt.h>
  1910. + #include <linux/errno.h>
  1911. + #include <linux/tty.h>
  1912. + #include <linux/termios.h>
  1913. + #include <linux/bootinfo.h>
  1914. + #include <linux/amigahw.h>
  1915. + #include <linux/amigaints.h>
  1916. + #include "serial.h"
  1917. + /* some serial hardware definitions */
  1918. + #define SDR_OVRUN   (1<<15)
  1919. + #define SDR_TBE     (1<<13)
  1920. + #define SDR_TSRE    (1<<12)
  1921. + #define AC_SETCLR   (1<<15)
  1922. + #define AC_UARTBRK  (1<<11)
  1923. + #define SER_DTR     (1<<7)
  1924. + #define SER_RTS     (1<<6)
  1925. + #define SER_DCD     (1<<5)
  1926. + #define SER_CTS     (1<<4)
  1927. + #define SER_DSR     (1<<3)
  1928. + /***************************** Prototypes *****************************/
  1929. + static void ser_rx_int( struct intframe *fp, struct async_struct *info );
  1930. + static void ser_tx_int( struct intframe *fp, struct async_struct *info );
  1931. + static void ser_vbl_int( struct intframe *fp, struct async_struct *info );
  1932. + static void ser_init( struct async_struct *info );
  1933. + static void ser_deinit( struct async_struct *info, int leave_dtr );
  1934. + static int  ser_check_custom_divisor( struct async_struct *info, int divisor );
  1935. + static void ser_change_speed( struct async_struct *info );
  1936. + static void ser_restart( struct async_struct *info );
  1937. + static void ser_throttle( struct async_struct *info, int status );
  1938. + static void ser_set_break( struct async_struct *info, int break_flag );
  1939. + static void ser_get_serial_info( struct async_struct *info,
  1940. +                 struct serial_struct *retinfo );
  1941. + static unsigned int ser_get_modem_info( struct async_struct *info );
  1942. + static int ser_set_modem_info( struct async_struct *info, int new_dtr,
  1943. +                   int new_rts );
  1944. + /************************* End of Prototypes **************************/
  1945. + /* SERIALSWITCH structure for the Amiga serial port
  1946. +  */
  1947. + static SERIALSWITCH amiga_ser_switch = {
  1948. +     ser_init, ser_deinit, NULL,
  1949. +     ser_check_custom_divisor, ser_change_speed,
  1950. +     ser_restart, ser_throttle, ser_set_break,
  1951. +     ser_get_serial_info, ser_get_modem_info,
  1952. +     ser_set_modem_info, NULL
  1953. + };
  1954. + /* Divisors for standard speeds (NTSC and PAL) */
  1955. + static int baud_table[2][15] = {
  1956. +     /* NTSC */
  1957. +     {
  1958. +     /* B0     */ 0,
  1959. +     /* B50    */ 71589,
  1960. +     /* B75    */ 47726,
  1961. +     /* B110   */ 32540,
  1962. +     /* B134      */ 26712,
  1963. +     /* B150      */ 23862,
  1964. +     /* B200      */ 17896,
  1965. +     /* B300      */ 11930,
  1966. +     /* B600      */ 5964,
  1967. +     /* B1200  */ 2892,
  1968. +     /* B1800  */ 1987,
  1969. +     /* B2400  */ 1490,
  1970. +     /* B4800  */ 744,
  1971. +     /* B9600  */ 371,
  1972. +     /* B19200 */ 185
  1973. +     },
  1974. +     /* PAL */
  1975. +     {
  1976. +     /* B0     */ 0,
  1977. +     /* B50    */ 70936,
  1978. +     /* B75    */ 47290,
  1979. +     /* B110   */ 32243,
  1980. +     /* B134      */ 26468,
  1981. +     /* B150      */ 23644,
  1982. +     /* B200      */ 17733,
  1983. +     /* B300      */ 11821,
  1984. +     /* B600      */ 5910,
  1985. +     /* B1200  */ 2954,
  1986. +     /* B1800  */ 1969,
  1987. +     /* B2400  */ 1476,
  1988. +     /* B4800  */ 737,
  1989. +     /* B9600  */ 368,
  1990. +     /* B19200 */ 183
  1991. +     }
  1992. + };
  1993. +     
  1994. + static __inline__ void ser_DTRoff(void)
  1995. + {
  1996. +     ciab.pra |= SER_DTR; /* active low */
  1997. + }
  1998. + static __inline__ void ser_DTRon(void)
  1999. + {
  2000. +     ciab.pra &= ~SER_DTR; /* active low */
  2001. + }
  2002. + static __inline__ void ser_RTSoff(void)
  2003. + {
  2004. +     ciab.pra |= SER_RTS; /* active low */
  2005. + }
  2006. + static __inline__ void ser_RTSon(void)
  2007. + {
  2008. +     ciab.pra &= ~SER_RTS; /* active low */
  2009. + }
  2010. + void amiga_serinit( struct async_struct *info )
  2011. + {    
  2012. +     unsigned long flags;
  2013. +     save_flags (flags);
  2014. +     cli();
  2015. +     /* set ISRs, and then disable the rx interrupts */
  2016. +     add_isr( IRQ_AMIGA_TBE, (isrfunc)ser_tx_int, 0, info);
  2017. +     add_isr( IRQ_AMIGA_RBF, (isrfunc)ser_rx_int, 0, info);
  2018. +     add_isr( IRQ_AMIGA_VERTB, (isrfunc)ser_vbl_int, 0, info );
  2019. +     custom.intena = IF_RBF;
  2020. +     /* clear any pending interrupts */
  2021. +     custom.intreq = IF_RBF | IF_TBE;
  2022. +     restore_flags (flags);
  2023. +     /*
  2024. +      * set the appropriate directions for the modem control flags,
  2025. +      * and clear RTS and DTR
  2026. +      */
  2027. +     ciab.ddra |= (SER_DTR | SER_RTS);   /* outputs */
  2028. +     ciab.ddra &= ~(SER_DCD | SER_CTS | SER_DSR);  /* inputs */
  2029. +     ciab.pra |= (SER_DTR | SER_RTS); /* active low */
  2030. +     
  2031. +     info->type            = SER_AMIGA;
  2032. +     info->base            = &custom.serdatr; /* dummy value */
  2033. +     info->RI.addr         = 0; /* NO RI */
  2034. +     info->RI.bitno        = 0;
  2035. +     info->RI.active_state = 0;
  2036. +     info->sw              = &amiga_ser_switch;
  2037. + }
  2038. + static void ser_rx_int( struct intframe *fp, struct async_struct *info )
  2039. + {
  2040. +     int        ch, err = 0;
  2041. +     
  2042. +     ch = custom.serdatr;
  2043. +     if (ch & SDR_OVRUN)
  2044. +     err = TTY_OVERRUN;
  2045. +     
  2046. +     ch &= 0x7f;
  2047. +     
  2048. +     rs_put_char_to_queue( info, ch, err );
  2049. +     rs_rx_throttle_if_needed( info );
  2050. + }
  2051. + static void ser_tx_int( struct intframe *fp, struct async_struct *info )
  2052. + {
  2053. +     int        ch;
  2054. +     if (custom.serdatr & SDR_TBE) {
  2055. +     if ((ch = rs_get_char_from_queue( info )) < 0) return;
  2056. +     custom.serdat = ch | 0x100;
  2057. +     rs_tx_wakeup_if_needed( info );
  2058. +     } else
  2059. +     printk ("ser_tx_int without TBE!\n");
  2060. + }
  2061. + /* This variable holds the current state of the DCD/CTS bits */
  2062. + static unsigned char current_ctl_bits;
  2063. + static void ser_vbl_int( struct intframe *fp, struct async_struct *info )
  2064. + {    
  2065. +     unsigned char bits;
  2066. +     if (!(info->flags & ASYNC_INITIALIZED))
  2067. +     return;
  2068. +     bits = ciaa.pra & (SER_DCD | SER_CTS);
  2069. +     if (bits ^ current_ctl_bits) {
  2070. +     if ((bits ^ current_ctl_bits) & SER_DCD)
  2071. +         rs_dcd_changed( info, !(bits & SER_DCD)); /* active low */
  2072. +     if ((bits ^ current_ctl_bits) & SER_CTS)
  2073. +         rs_cts_changed( info, !(bits & SER_CTS)); /* active low */
  2074. +     }
  2075. +     current_ctl_bits = bits;
  2076. + }
  2077. + static void ser_init( struct async_struct *info )
  2078. + {    
  2079. +     /* enable Rx interrupts */
  2080. +     custom.intena = IF_SETCLR | IF_RBF;
  2081. +     /* turn on DTR and RTS */
  2082. +     ser_DTRon();
  2083. +     ser_RTSon();
  2084. +     /* remember current state of the DCD and CTS bits */
  2085. +     current_ctl_bits = ciaa.pra & (SER_DCD | SER_CTS);
  2086. + }
  2087. + static void ser_deinit( struct async_struct *info, int leave_dtr )
  2088. + {
  2089. +     /* disable Rx interrupts */
  2090. +     custom.intena = IF_RBF;
  2091. +     /* wait for last byte to be completely shifted out */
  2092. +     while( !(custom.serdatr & SDR_TSRE) )
  2093. +     ;
  2094. +     /* drop RTS and DTR if required */
  2095. +     ser_RTSoff();
  2096. +     if (!leave_dtr)
  2097. +     ser_DTRoff();
  2098. + }
  2099. + static int ser_check_custom_divisor( struct async_struct *info, int divisor )
  2100. + {
  2101. +     /* allow any divisor */
  2102. +     return 1;
  2103. + }
  2104. + static void ser_change_speed( struct async_struct *info )
  2105. + {
  2106. +     unsigned    cflag, baud, chsize, stopb, parity, aflags;
  2107. +     unsigned    div = 0;
  2108. +     
  2109. +     if (!info->tty || !info->tty->termios) return;
  2110. +     cflag  = info->tty->termios->c_cflag;
  2111. +     baud   = cflag & CBAUD;
  2112. +     chsize = cflag & CSIZE;
  2113. +     stopb  = cflag & CSTOPB;
  2114. +     parity = cflag & (PARENB | PARODD);
  2115. +     aflags = info->flags & ASYNC_SPD_MASK;
  2116. +     if (baud == 15 && aflags == ASYNC_SPD_CUST)
  2117. +     div = info->custom_divisor;
  2118. +     else {
  2119. +     /* Maximum  speed is 19200 :-( */
  2120. +     if (baud > 14) baud = 14;
  2121. +     if (boot_info.bi_amiga.eclock == NTSC_ECLOCK)
  2122. +         div = baud_table[0][baud];
  2123. +     else
  2124. +         div = baud_table[1][baud];
  2125. +     }
  2126. +     if (!div) {
  2127. +     /* speed == 0 -> drop DTR */
  2128. +     ser_DTRoff();
  2129. +     return;
  2130. +     }
  2131. +     /* setup the serial port period register */
  2132. +     custom.serper = div;
  2133. + }
  2134. +     
  2135. +     
  2136. + static void ser_restart( struct async_struct *info )
  2137. + {
  2138. +     int ch;
  2139. +     if ((custom.serdatr & SDR_TBE) && !(custom.intreqr & IF_TBE))
  2140. +     if ((ch = rs_get_char_from_queue (info)) >= 0)
  2141. +         custom.serdat = ch | 0x100;
  2142. + }
  2143. + static void ser_throttle( struct async_struct *info, int status )
  2144. + {
  2145. +     if (status == TTY_THROTTLE_RQ_FULL)
  2146. +     ser_RTSoff();
  2147. +     else if (status == TTY_THROTTLE_RQ_AVAIL)
  2148. +     ser_RTSon();
  2149. + }
  2150. + static void ser_set_break( struct async_struct *info, int break_flag )
  2151. + {
  2152. +     if (break_flag)
  2153. +     custom.adkcon = AC_SETCLR | AC_UARTBRK;
  2154. +     else
  2155. +     custom.adkcon = AC_UARTBRK;
  2156. + }
  2157. + static void ser_get_serial_info( struct async_struct *info,
  2158. +                 struct serial_struct *retinfo )
  2159. + {
  2160. +     retinfo->baud_base = 0;
  2161. +     retinfo->custom_divisor = info->custom_divisor;
  2162. + }
  2163. + static unsigned int ser_get_modem_info( struct async_struct *info )
  2164. + {
  2165. +     unsigned int minfo = ciab.pra;
  2166. +     return(
  2167. +        ((minfo & SER_DTR) ? 0 : TIOCM_DTR) |
  2168. +        ((minfo & SER_RTS) ? 0 : TIOCM_RTS) |
  2169. +        ((minfo & SER_DCD) ? 0 : TIOCM_CAR) |
  2170. +        ((minfo & SER_CTS) ? 0 : TIOCM_CTS) |
  2171. +        ((minfo & SER_DSR) ? 0 : TIOCM_DSR) |
  2172. +        /* TICM_RNG */ 0
  2173. +        );
  2174. + }
  2175. + static int ser_set_modem_info( struct async_struct *info,
  2176. +                   int new_dtr, int new_rts )
  2177. + {
  2178. +     if (new_dtr == 0)
  2179. +     ser_DTRoff();
  2180. +     else if (new_dtr == 1)
  2181. +     ser_DTRon();
  2182. +     
  2183. +     if (new_rts == 0)
  2184. +     ser_RTSoff();
  2185. +     else if (new_rts == 1)
  2186. +     ser_RTSon();
  2187. +     return( 0 );
  2188. + }
  2189. diff -cr --new-file linux-0.9pl1/drivers/char/atari_MFPser.c linux-0.9pl2/drivers/char/atari_MFPser.c
  2190. *** linux-0.9pl1/drivers/char/atari_MFPser.c    Sun Jun 26 19:23:54 1994
  2191. --- linux-0.9pl2/drivers/char/atari_MFPser.c    Sun Aug  7 11:52:59 1994
  2192. ***************
  2193. *** 44,50 ****
  2194.   #include <linux/atarihw.h>
  2195.   #include <linux/atariints.h>
  2196.   
  2197. ! #include "atari_serial.h"
  2198.   #include "atari_MFPser.h"
  2199.   
  2200.   
  2201. --- 44,50 ----
  2202.   #include <linux/atarihw.h>
  2203.   #include <linux/atariints.h>
  2204.   
  2205. ! #include "serial.h"
  2206.   #include "atari_MFPser.h"
  2207.   
  2208.   
  2209. ***************
  2210. *** 65,71 ****
  2211.   static int MFPser_check_custom_divisor( struct async_struct *info, int
  2212.                                           divisor );
  2213.   static void MFPser_change_speed( struct async_struct *info );
  2214. ! static void MFPser_restart( struct async_struct *info, int ch );
  2215.   static void MFPctrl_throttle( struct async_struct *info, int status );
  2216.   static void MFPbare_throttle( struct async_struct *info, int status );
  2217.   static void MFPser_set_break( struct async_struct *info, int break_flag );
  2218. --- 65,71 ----
  2219.   static int MFPser_check_custom_divisor( struct async_struct *info, int
  2220.                                           divisor );
  2221.   static void MFPser_change_speed( struct async_struct *info );
  2222. ! static void MFPser_restart( struct async_struct *info );
  2223.   static void MFPctrl_throttle( struct async_struct *info, int status );
  2224.   static void MFPbare_throttle( struct async_struct *info, int status );
  2225.   static void MFPser_set_break( struct async_struct *info, int break_flag );
  2226. ***************
  2227. *** 155,161 ****
  2228.       info->RI.bitno        = ri_bitno;
  2229.       info->RI.active_state = ri_active;
  2230.       info->sw              = (type == MFP_CTRL) ? &MFPctrl_switch :
  2231. !                                                  &MFPbare_switch;
  2232.   
  2233.       currMFP(info)->rcv_stat  = 0;    /* disable Rx */
  2234.       currMFP(info)->trn_stat  = 0;    /* disable Tx */
  2235. --- 155,161 ----
  2236.       info->RI.bitno        = ri_bitno;
  2237.       info->RI.active_state = ri_active;
  2238.       info->sw              = (type == MFP_CTRL) ? &MFPctrl_switch :
  2239. !                                                  &MFPbare_switch;
  2240.   
  2241.       currMFP(info)->rcv_stat  = 0;    /* disable Rx */
  2242.       currMFP(info)->trn_stat  = 0;    /* disable Tx */
  2243. ***************
  2244. *** 407,417 ****
  2245.   }
  2246.       
  2247.       
  2248. ! static void MFPser_restart( struct async_struct *info, int ch )
  2249.   
  2250.   {
  2251. !     if (ch >= 0 && currMFP(info)->trn_stat & TSR_BUF_EMPTY)
  2252. !         currMFP(info)->usart_dta = ch;
  2253.   }
  2254.   
  2255.   
  2256. --- 407,419 ----
  2257.   }
  2258.       
  2259.       
  2260. ! static void MFPser_restart( struct async_struct *info )
  2261.   
  2262.   {
  2263. !         int ch;
  2264. !     if (currMFP(info)->trn_stat & TSR_BUF_EMPTY)
  2265. !             if ((ch = rs_get_char_from_queue (info)) >= 0)
  2266. !                 currMFP(info)->usart_dta = ch;
  2267.   }
  2268.   
  2269.   
  2270. diff -cr --new-file linux-0.9pl1/drivers/char/atari_SCC.c linux-0.9pl2/drivers/char/atari_SCC.c
  2271. *** linux-0.9pl1/drivers/char/atari_SCC.c    Sun Jun 26 19:23:55 1994
  2272. --- linux-0.9pl2/drivers/char/atari_SCC.c    Sat Aug  6 20:38:48 1994
  2273. ***************
  2274. *** 24,30 ****
  2275.   #include <linux/atarihw.h>
  2276.   #include <linux/atariints.h>
  2277.   
  2278. ! #include "atari_serial.h"
  2279.   #include "atari_MFPser.h"
  2280.   
  2281.   
  2282. --- 24,30 ----
  2283.   #include <linux/atarihw.h>
  2284.   #include <linux/atariints.h>
  2285.   
  2286. ! #include "serial.h"
  2287.   #include "atari_MFPser.h"
  2288.   
  2289.   
  2290. diff -cr --new-file linux-0.9pl1/drivers/char/atari_SCC.h linux-0.9pl2/drivers/char/atari_SCC.h
  2291. *** linux-0.9pl1/drivers/char/atari_SCC.h    Sun Jun 26 19:23:56 1994
  2292. --- linux-0.9pl2/drivers/char/atari_SCC.h    Sat Aug  6 20:06:35 1994
  2293. ***************
  2294. *** 18,24 ****
  2295.   #define _ATARI_SCC_H
  2296.   
  2297.   #include <linux/atarihw.h>
  2298. ! #include "atari_serial.h"
  2299.   
  2300.   /***********************************************************************/
  2301.   /*                                                                     */
  2302. --- 18,24 ----
  2303.   #define _ATARI_SCC_H
  2304.   
  2305.   #include <linux/atarihw.h>
  2306. ! #include "serial.h"
  2307.   
  2308.   /***********************************************************************/
  2309.   /*                                                                     */
  2310. diff -cr --new-file linux-0.9pl1/drivers/char/atari_serial.c linux-0.9pl2/drivers/char/atari_serial.c
  2311. *** linux-0.9pl1/drivers/char/atari_serial.c    Sun Jun 26 19:23:58 1994
  2312. --- linux-0.9pl2/drivers/char/atari_serial.c    Wed Dec 31 19:00:00 1969
  2313. ***************
  2314. *** 1,983 ****
  2315. - /*
  2316. -  * drivers/char/atari_serial.c: Common source file for all Atari serial ports
  2317. -  *
  2318. -  * Copyright 1994 Roman Hodek
  2319. -  *   EMail: rnhodek@cip.informatik.uni-erlangen.de (Internet)
  2320. -  *      or: Roman_Hodek@n.maus.de (MausNet, NO mail > 16 KB!)
  2321. -  *
  2322. -  * Partially based on PC-Linux serial.c by Linus Torvalds and Theodore Ts'o
  2323. -  * 
  2324. -  * This file is subject to the terms and conditions of the GNU General Public
  2325. -  * License.  See the file README.legal in the main directory of this archive
  2326. -  * for more details.
  2327. -  *
  2328. -  */
  2329. - /*
  2330. -  * Notes and Design Goals:
  2331. -  * -----------------------
  2332. -  * The PC serial drivers can rely on the fact that all the serial
  2333. -  * hardware is very similar to program for all ports. Unfortunately,
  2334. -  * this is not true for the Atari. Here it is nearly the other way
  2335. -  * round: All ports need different treatment for the low-level stuff.
  2336. -  *
  2337. -  * For this reason, I split the serial driver code into a
  2338. -  * port-independent part (atari_serial.c) and port-specific parts
  2339. -  * (atari_*.c). The first manages all what can be done without
  2340. -  * accessing the hardware directly, i.e. interfacing with the
  2341. -  * high-level tty drivers, wait queues, managing the existing ports
  2342. -  * and the like. The latter do the actual hardware programming and are
  2343. -  * accessed by the hardware-independant part by a "switch" structure,
  2344. -  * that contains pointers to functions for specific tasks. See the
  2345. -  * comment before the definition of the SERIALSWITCH structure in
  2346. -  * atari_serial.h for more details.
  2347. -  *
  2348. -  * Despite its name, the port-independant code should be usable by
  2349. -  * other machines than Atari, too, if there are similar circumstances
  2350. -  * with different serial port hardware. Feel free to use it, but
  2351. -  * please inform me if you have to do changes to it. I'll try to keep
  2352. -  * it really device-independant. 
  2353. -  *
  2354. -  */
  2355. - #include <linux/types.h>
  2356. - #include <linux/sched.h>
  2357. - #include <linux/timer.h>
  2358. - #include <linux/errno.h>
  2359. - #include <linux/string.h>
  2360. - #include <linux/bootinfo.h>
  2361. - #include <linux/tty.h>
  2362. - #include <linux/termios.h>
  2363. - #include <linux/major.h>
  2364. - #include <linux/fcntl.h>
  2365. - #include <asm/bitops.h>
  2366. - #include <asm/segment.h>
  2367. - #include "atari_serial.h"
  2368. - #include "atari_SCC.h"
  2369. - #include "atari_MFPser.h"
  2370. - struct async_struct rs_table[ NR_PORTS ];
  2371. - char rs_event[ (NR_PORTS + 7) / 8 ];
  2372. - /***************************** Prototypes *****************************/
  2373. - static inline void handle_rs_break( struct async_struct *info );
  2374. - static void do_softint( void *unused );
  2375. - static int startup( struct async_struct * info, int get_irq );
  2376. - static void shutdown( struct async_struct * info, int do_free_irq );
  2377. - static int get_serial_info( struct async_struct * info, struct
  2378. -                             serial_struct * retinfo );
  2379. - static int set_serial_info( struct async_struct * info, struct
  2380. -                             serial_struct * new_info );
  2381. - static int get_modem_info( struct async_struct * info, unsigned int *value
  2382. -                            );
  2383. - static int set_modem_info( struct async_struct * info, unsigned int cmd,
  2384. -                            unsigned int *value );
  2385. - static void send_break( struct async_struct * info, int duration );
  2386. - static int rs_ioctl( struct tty_struct *tty, struct file * file, unsigned
  2387. -                      int cmd, unsigned long arg );
  2388. - static void rs_set_termios( struct tty_struct *tty, struct termios
  2389. -                             *old_termios );
  2390. - static void rs_close( struct tty_struct *tty, struct file * filp );
  2391. - static int block_til_ready( struct tty_struct *tty, struct file * filp,
  2392. -                             struct async_struct *info );
  2393. - /************************* End of Prototypes **************************/
  2394. - /*
  2395. -  * ------------------------------------------------------------
  2396. -  * rs_stop() and rs_start()
  2397. -  *
  2398. -  * This routines are called before setting or resetting tty->stopped.
  2399. -  * They enable or disable transmitter interrupts, as necessary.
  2400. -  * ------------------------------------------------------------ */
  2401. - void rs_stop( struct tty_struct *tty )
  2402. - {
  2403. -     struct async_struct *info;
  2404. -     
  2405. -     info = rs_table + DEV_TO_SL(tty->line);
  2406. -     if (info->flags & ASYNC_CLOSING) {
  2407. -         tty->stopped = 0;
  2408. -         tty->hw_stopped = 0;
  2409. -         return;
  2410. -     }
  2411. -     if (info->sw->enab_tx_int)
  2412. -         info->sw->enab_tx_int( info, 0 );
  2413. - }
  2414. - void rs_start( struct tty_struct *tty )
  2415. - {
  2416. -     struct async_struct *info;
  2417. -     info = rs_table + DEV_TO_SL(tty->line);
  2418. -     
  2419. -     if (info->sw->enab_tx_int) {
  2420. -         info->sw->enab_tx_int( info, 1 );
  2421. -     }
  2422. - }
  2423. - /*
  2424. -  * This routine is called when we receive a break on a serial line.
  2425. -  * It is executed out of the software interrupt routine.
  2426. -  */
  2427. - static inline void handle_rs_break( struct async_struct *info )
  2428. - {
  2429. -     if (info->flags & ASYNC_SAK)
  2430. -         do_SAK(info->tty);
  2431. -         
  2432. -     if (!I_IGNBRK(info->tty) && I_BRKINT(info->tty)) {
  2433. -         flush_input(info->tty);
  2434. -         flush_output(info->tty);
  2435. -         if (info->tty->pgrp > 0)
  2436. -             kill_pg(info->tty->pgrp, SIGINT, 1 );
  2437. -     }
  2438. - }
  2439. - /*
  2440. -  * This routine is used to handle the "bottom half" processing for the
  2441. -  * serial driver, known also the "software interrupt" processing.
  2442. -  * This processing is done at the kernel interrupt level, after the
  2443. -  * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON.  This
  2444. -  * is where time-consuming activities which can not be done in the
  2445. -  * interrupt driver proper are done; the interrupt driver schedules
  2446. -  * them using rs_sched_event(), and they get done here.
  2447. -  */
  2448. - static void do_softint( void *unused )
  2449. - {
  2450. -     int            i;
  2451. -     struct async_struct    *info;
  2452. -     
  2453. -     for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
  2454. -         if (clear_bit(i, rs_event)) {
  2455. -             if (!info->tty)    
  2456. -                 continue;
  2457. -             if (clear_bit(RS_EVENT_READ_PROCESS, &info->event)) {
  2458. -                 TTY_READ_FLUSH(info->tty);
  2459. -             }
  2460. -             if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
  2461. -                 wake_up_interruptible(&info->tty->write_q.proc_list);
  2462. -             }
  2463. -             if (clear_bit(RS_EVENT_HANGUP, &info->event)) {
  2464. -                 tty_hangup(info->tty);
  2465. -                 wake_up_interruptible(&info->open_wait);
  2466. -                 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
  2467. -             }
  2468. -             if (clear_bit(RS_EVENT_BREAK, &info->event))
  2469. -                 handle_rs_break(info);
  2470. -             if (clear_bit(RS_EVENT_OPEN_WAKEUP, &info->event)) {
  2471. -                 wake_up_interruptible(&info->open_wait);
  2472. -             }
  2473. -         }
  2474. -     }
  2475. - }
  2476. - static int startup( struct async_struct * info, int get_irq )
  2477. - {
  2478. -     unsigned long flags;
  2479. -     if (info->flags & ASYNC_INITIALIZED)
  2480. -         return 0;
  2481. -     if (!info->base || !info->type) {
  2482. -         if (info->tty)
  2483. -             set_bit(TTY_IO_ERROR, &info->tty->flags);
  2484. -         return 0;
  2485. -     }
  2486. -     save_flags(flags); cli();
  2487. - #ifdef SERIAL_DEBUG_OPEN
  2488. -     printk("starting up ttys%d (irq %d)...", info->line, info->irq);
  2489. - #endif
  2490. -     info->sw->init( info );
  2491. -     if (info->tty)
  2492. -         clear_bit(TTY_IO_ERROR, &info->tty->flags);
  2493. -     /*
  2494. -      * Set the speed and other port parameters.
  2495. -      */
  2496. -     info->sw->change_speed( info );
  2497. -     info->flags |= ASYNC_INITIALIZED;
  2498. -     restore_flags(flags);
  2499. -     return 0;
  2500. - }
  2501. - /*
  2502. -  * This routine will shutdown a serial port; interrupts are disabled, and
  2503. -  * DTR is dropped if the hangup on close termio flag is on.
  2504. -  */
  2505. - static void shutdown( struct async_struct * info, int do_free_irq )
  2506. - {
  2507. -     unsigned long flags;
  2508. -     if (!(info->flags & ASYNC_INITIALIZED))
  2509. -         return;
  2510. - #ifdef SERIAL_DEBUG_OPEN
  2511. -     printk("Shutting down serial port %d (irq %d)....", info->line,
  2512. -            info->irq);
  2513. - #endif
  2514. -     
  2515. -     save_flags(flags); cli(); /* Disable interrupts */
  2516. -     
  2517. -     info->sw->deinit( info, info->tty &&
  2518. -                             !(info->tty->termios->c_cflag & HUPCL) );
  2519. -     
  2520. -     if (info->tty)
  2521. -         set_bit(TTY_IO_ERROR, &info->tty->flags);
  2522. -     
  2523. -     info->flags &= ~ASYNC_INITIALIZED;
  2524. -     restore_flags(flags);
  2525. - }
  2526. - /*
  2527. -  * ------------------------------------------------------------
  2528. -  * rs_write() and friends
  2529. -  * ------------------------------------------------------------
  2530. -  */
  2531. - /*
  2532. -  * This routine gets called when tty_write has put something into
  2533. -  * the write_queue.  
  2534. -  */
  2535. - void rs_write( struct tty_struct * tty )
  2536. - {    struct async_struct *info;
  2537. -     if (!tty || tty->stopped || tty->hw_stopped)
  2538. -         return;
  2539. -     info = rs_table + DEV_TO_SL(tty->line);
  2540. -     
  2541. -     if (!info || !info->tty || !(info->flags & ASYNC_INITIALIZED))
  2542. -         return;
  2543. -     cli();
  2544. -     info->sw->restart( info, rs_get_char_from_queue( info ) );
  2545. -     if (info->sw->enab_tx_int)
  2546. -         info->sw->enab_tx_int( info, 1 );
  2547. -     sti();
  2548. - }
  2549. - /*
  2550. -  * ------------------------------------------------------------
  2551. -  * rs_throttle()
  2552. -  * 
  2553. -  * This routine is called by the upper-layer tty layer to signal that
  2554. -  * incoming characters should be throttled (and that the throttle
  2555. -  * should be released).
  2556. -  * ------------------------------------------------------------
  2557. -  */
  2558. - void rs_throttle( struct tty_struct * tty, int status )
  2559. - {
  2560. -     struct async_struct *info;
  2561. -     unsigned long flags;
  2562. -     save_flags(flags); cli();
  2563. - #if SERIAL_DEBUG_THROTTLE
  2564. -     printk("throttle tty%d: %d (%d, %d)....\n", DEV_TO_SL(tty->line),
  2565. -            status, LEFT(&tty->read_q), LEFT(&tty->secondary));
  2566. - #endif
  2567. -     switch( status ) {
  2568. -       case TTY_THROTTLE_RQ_FULL:
  2569. -         info = rs_table + DEV_TO_SL(tty->line);
  2570. -         if (I_IXOFF(tty))
  2571. -             info->x_char = STOP_CHAR(tty);
  2572. -         else if (C_CRTSCTS(tty))
  2573. -             info->sw->throttle( info, status );
  2574. -         break;
  2575. -       case TTY_THROTTLE_RQ_AVAIL:
  2576. -         info = rs_table + DEV_TO_SL(tty->line);
  2577. -         if (I_IXOFF(tty)) {
  2578. -             if (info->x_char)
  2579. -                 info->x_char = 0;
  2580. -             else
  2581. -                 info->x_char = START_CHAR(tty);
  2582. -         } else if (C_CRTSCTS(tty))
  2583. -             info->sw->throttle( info, status );
  2584. -         break;
  2585. -     }
  2586. -     restore_flags(flags);
  2587. - }
  2588. - /*
  2589. -  * ------------------------------------------------------------
  2590. -  * rs_ioctl() and friends
  2591. -  * ------------------------------------------------------------
  2592. -  */
  2593. - static int get_serial_info( struct async_struct * info,
  2594. -                             struct serial_struct * retinfo )
  2595. - {
  2596. -     struct serial_struct tmp;
  2597. -   
  2598. -     if (!retinfo)
  2599. -         return -EFAULT;
  2600. -     /* Set port-independant data */
  2601. -     memset(&tmp, 0, sizeof(tmp));
  2602. -     tmp.type        = info->type;
  2603. -     tmp.line        = info->line;
  2604. -     tmp.port        = 0;    /* meaningless for non-Intel */
  2605. -     tmp.irq         = 0;    /* meaningless for Atari */
  2606. -     tmp.flags       = info->flags;
  2607. -     tmp.close_delay = info->close_delay;
  2608. -     tmp.hub6        = 0;    /* meaningless for Atari */
  2609. -     /* At least baud_base and costum_divisor set by port-specific
  2610. -      * function
  2611. -      */
  2612. -     info->sw->get_serial_info( info, &tmp );
  2613. -     
  2614. -     memcpy_tofs( retinfo, &tmp, sizeof(*retinfo) );
  2615. -     return 0;
  2616. - }
  2617. - static int set_serial_info( struct async_struct * info,
  2618. -                             struct serial_struct * new_info )
  2619. - {
  2620. -     struct serial_struct    new_serial;
  2621. -     struct async_struct     old_info;
  2622. -     
  2623. -     if (!new_info) return( -EFAULT );
  2624. -     memcpy_fromfs( &new_serial, new_info, sizeof(new_serial) );
  2625. -     old_info = *info;
  2626. -     /* The fields type, line, port, irq, xmit_fifo_size, baud_base and
  2627. -      * hub6 of new_info are silently ignored for the Atari, since they
  2628. -      * are meaningless or cannot be changed, resp. Is this right or
  2629. -      * should an error be returned?
  2630. -      */
  2631. -     /* If a new custom divisor is to be set, let it check by the
  2632. -      * hardware specific code first!
  2633. -      */
  2634. -     if (new_serial.custom_divisor != info->custom_divisor) {
  2635. -         if (info->sw->check_custom_divisor( info, new_serial.custom_divisor ))
  2636. -             return( -EINVAL );
  2637. -     }
  2638. -     
  2639. -     if (!suser()) {
  2640. -         if ((new_serial.close_delay != info->close_delay) ||
  2641. -             ((new_serial.flags & ~ASYNC_USR_MASK) !=
  2642. -              (info->flags & ~ASYNC_USR_MASK))) return( -EPERM );
  2643. -         info->flags = ((info->flags & ~ASYNC_USR_MASK) |
  2644. -                        (new_serial.flags & ASYNC_USR_MASK));
  2645. -         info->custom_divisor = new_serial.custom_divisor;
  2646. -         goto check_and_exit;
  2647. -     }
  2648. -     /*
  2649. -      * OK, past this point, all the error checking has been done.
  2650. -      * At this point, we start making changes.....
  2651. -      */
  2652. -     info->flags = ((info->flags & ~ASYNC_FLAGS) |
  2653. -                    (new_serial.flags & ASYNC_FLAGS));
  2654. -     info->custom_divisor = new_serial.custom_divisor;
  2655. -     info->close_delay = new_serial.close_delay;
  2656. - check_and_exit:
  2657. -     if (info->flags & ASYNC_INITIALIZED) {
  2658. -         if (((old_info.flags & ASYNC_SPD_MASK) !=
  2659. -              (info->flags & ASYNC_SPD_MASK)) ||
  2660. -             (old_info.custom_divisor != info->custom_divisor))
  2661. -             info->sw->change_speed( info ); 
  2662. -     }
  2663. -     else
  2664. -         (void)startup( info, 0 );
  2665. -     return 0;
  2666. - }
  2667. - static int get_modem_info( struct async_struct * info,
  2668. -                            unsigned int *value )
  2669. - {
  2670. -     unsigned int result;
  2671. -     result = info->sw->get_modem_info( info );
  2672. -     put_fs_long( result, (unsigned long *) value );
  2673. -     return 0;
  2674. - }
  2675. - static int set_modem_info( struct async_struct * info, unsigned int cmd,
  2676. -                            unsigned int *value )
  2677. - {    unsigned    arg = get_fs_long((unsigned long *) value);
  2678. -     int            new_dtr = -1, new_rts = -1;
  2679. -     switch( cmd ) {
  2680. -       case TIOCMBIS:
  2681. -         if (arg & TIOCM_DTR) new_dtr = 1;
  2682. -         if (arg & TIOCM_RTS) new_rts = 1;
  2683. -         break;
  2684. -       case TIOCMBIC:
  2685. -         if (arg & TIOCM_DTR) new_dtr = 0;
  2686. -         if (arg & TIOCM_RTS) new_rts = 0;
  2687. -         break;
  2688. -       case TIOCMSET:
  2689. -         new_dtr = !!(arg & TIOCM_DTR);
  2690. -         new_rts = !!(arg & TIOCM_RTS);
  2691. -         break;
  2692. -       default:
  2693. -         return( -EINVAL );
  2694. -     }
  2695. -     
  2696. -     return( info->sw->set_modem_info( info, new_dtr, new_rts ) );
  2697. - }
  2698. - /*
  2699. -  * This routine sends a break out the serial port.
  2700. -  */
  2701. - static void send_break(    struct async_struct * info, int duration )
  2702. - {
  2703. -     if (!info->base) return;
  2704. -     
  2705. -     current->state = TASK_INTERRUPTIBLE;
  2706. -     current->timeout = jiffies + duration;
  2707. -     cli();
  2708. -     info->sw->set_break( info, 1 );
  2709. -     schedule();
  2710. -     info->sw->set_break( info, 0 );
  2711. -     sti();
  2712. - }
  2713. - static int rs_ioctl( struct tty_struct *tty, struct file * file,
  2714. -                      unsigned int cmd, unsigned long arg )
  2715. - {
  2716. -     int error, line;
  2717. -     struct async_struct * info;
  2718. -     line = DEV_TO_SL(tty->line);
  2719. -     if (line < 0 || line >= NR_PORTS)
  2720. -         return -ENODEV;
  2721. -     info = rs_table + line;
  2722. -     if (!info->base) return( -ENODEV );
  2723. -     
  2724. -     switch( cmd ) {
  2725. -       case TCSBRK:    /* SVID version: non-zero arg --> no break */
  2726. -         if (!arg)
  2727. -             send_break(info, HZ/4);    /* 1/4 second */
  2728. -         return 0;
  2729. -       case TCSBRKP:    /* support for POSIX tcsendbreak() */
  2730. -         send_break(info, arg ? arg*(HZ/10) : HZ/4);
  2731. -         return 0;
  2732. -       case TIOCGSOFTCAR:
  2733. -         error = verify_area(VERIFY_WRITE, (void *) arg,sizeof(long));
  2734. -         if (error)
  2735. -             return error;
  2736. -         put_fs_long(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg);
  2737. -         return 0;
  2738. -       case TIOCSSOFTCAR:
  2739. -         arg = get_fs_long((unsigned long *) arg);
  2740. -         tty->termios->c_cflag =
  2741. -             ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
  2742. -         return 0;
  2743. -       case TIOCMGET:
  2744. -         error = verify_area(VERIFY_WRITE, (void *) arg,
  2745. -                             sizeof(unsigned int));
  2746. -         if (error)
  2747. -             return error;
  2748. -         return get_modem_info(info, (unsigned int *) arg);
  2749. -       case TIOCMBIS:
  2750. -       case TIOCMBIC:
  2751. -       case TIOCMSET:
  2752. -         return set_modem_info(info, cmd, (unsigned int *) arg);
  2753. -       case TIOCGSERIAL:
  2754. -         error = verify_area(VERIFY_WRITE, (void *) arg,
  2755. -                             sizeof(struct serial_struct));
  2756. -         if (error)
  2757. -             return error;
  2758. -         return get_serial_info(info, (struct serial_struct *) arg);
  2759. -       case TIOCSSERIAL:
  2760. -         return set_serial_info(info, (struct serial_struct *) arg);
  2761. -       case TIOCSERCONFIG:
  2762. -         /* return do_autoconfig(info); */
  2763. -         return( 0 );
  2764. -         
  2765. -       default:
  2766. -         if (info->sw->ioctl)
  2767. -             return( info->sw->ioctl( tty, file, info, cmd, arg ) );
  2768. -         else
  2769. -             return( -EINVAL );
  2770. -     }
  2771. -     return 0;
  2772. - }
  2773. - static void rs_set_termios( struct tty_struct *tty,
  2774. -                             struct termios *old_termios )
  2775. - {
  2776. -     struct async_struct *info;
  2777. -     if (tty->termios->c_cflag == old_termios->c_cflag)
  2778. -         return;
  2779. -     info = &rs_table[DEV_TO_SL(tty->line)];
  2780. -     info->sw->change_speed( info );
  2781. -     
  2782. -     if ((old_termios->c_cflag & CRTSCTS) &&
  2783. -         !(tty->termios->c_cflag & CRTSCTS)) {
  2784. -         tty->hw_stopped = 0;
  2785. -         rs_write(tty);
  2786. -     }
  2787. -     if (!(old_termios->c_cflag & CLOCAL) &&
  2788. -         (tty->termios->c_cflag & CLOCAL))
  2789. -         wake_up_interruptible(&info->open_wait);
  2790. - }
  2791. - /*
  2792. -  * ------------------------------------------------------------
  2793. -  * rs_close()
  2794. -  * 
  2795. -  * This routine is called when the serial port gets closed.  First, we
  2796. -  * wait for the last remaining data to be sent.  Then, we unlink its
  2797. -  * async structure from the interrupt chain if necessary, and we free
  2798. -  * that IRQ if nothing is left in the chain.
  2799. -  * ------------------------------------------------------------
  2800. -  */
  2801. - static void rs_close( struct tty_struct *tty, struct file * filp )
  2802. - {
  2803. -     struct async_struct * info;
  2804. -     int line;
  2805. -     if (tty_hung_up_p(filp)) return;
  2806. -     
  2807. -     line = DEV_TO_SL(tty->line);
  2808. -     if ((line < 0) || (line >= NR_PORTS)) return;
  2809. -     info = rs_table + line;
  2810. -     if (!info->base) return;
  2811. -     
  2812. - #ifdef SERIAL_DEBUG_OPEN
  2813. -     printk("rs_close ttys%d, count = %d\n", info->line, info->count);
  2814. - #endif
  2815. -     if ((tty->count == 1) && (info->count != 1)) {
  2816. -         /*
  2817. -          * Uh, oh.  tty->count is 1, which means that the tty
  2818. -          * structure will be freed.  Info->count should always
  2819. -          * be one in these conditions.  If it's greater than
  2820. -          * one, we've got real problems, since it means the
  2821. -          * serial port won't be shutdown.
  2822. -          */
  2823. -         printk("rs_close: bad serial port count; tty->count is 1, "
  2824. -                "info->count is %d\n", info->count);
  2825. -         info->count = 1;
  2826. -     }
  2827. -     if (--info->count < 0) {
  2828. -         printk("rs_close: bad serial port count for ttys%d: %d\n",
  2829. -                info->line, info->count);
  2830. -         info->count = 0;
  2831. -     }
  2832. -     if (info->count)
  2833. -         return;
  2834. -     info->flags |= ASYNC_CLOSING;
  2835. -     /*
  2836. -      * Save the termios structure, since this port may have
  2837. -      * separate termios for callout and dialin.
  2838. -      */
  2839. -     if (info->flags & ASYNC_NORMAL_ACTIVE)
  2840. -         info->normal_termios = *tty->termios;
  2841. -     if (info->flags & ASYNC_CALLOUT_ACTIVE)
  2842. -         info->callout_termios = *tty->termios;
  2843. -     tty->stopped = 0;        /* Force flush to succeed */
  2844. -     tty->hw_stopped = 0;
  2845. -     if (info->flags & ASYNC_INITIALIZED) {
  2846. -         rs_start(tty);
  2847. -         wait_until_sent(tty, 6000); /* 60 seconds timeout */
  2848. -     } else
  2849. -         flush_output(tty);
  2850. -     flush_input(tty);
  2851. -     shutdown(info, 1);
  2852. -     clear_bit(line, rs_event);
  2853. -     info->event = 0;
  2854. -     info->tty = 0;
  2855. -     if (info->blocked_open) {
  2856. -         if (info->close_delay) {
  2857. -             tty->count++; /* avoid race condition */
  2858. -             current->state = TASK_INTERRUPTIBLE;
  2859. -             current->timeout = jiffies + info->close_delay;
  2860. -             schedule();
  2861. -             tty->count--;
  2862. -         }
  2863. -         wake_up_interruptible(&info->open_wait);
  2864. -     }
  2865. -     info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|ASYNC_CLOSING);
  2866. -     wake_up_interruptible(&info->close_wait);
  2867. - }
  2868. - /*
  2869. -  * rs_hangup() --- called by tty_hangup() when a hangup is signaled.
  2870. -  */
  2871. - void rs_hangup( struct tty_struct *tty )
  2872. - {
  2873. -     struct async_struct * info;
  2874. -     int line;
  2875. -     line = DEV_TO_SL(tty->line);
  2876. -     if ((line < 0) || (line >= NR_PORTS)) return;
  2877. -     info = rs_table + line;
  2878. -     if (!info->base) return;
  2879. -     
  2880. -     shutdown(info, 1);
  2881. -     clear_bit(line, rs_event);
  2882. -     info->event = 0;
  2883. -     info->count = 0;
  2884. -     info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
  2885. -     info->tty = 0;
  2886. -     wake_up_interruptible(&info->open_wait);
  2887. - }
  2888. - /*
  2889. -  * ------------------------------------------------------------
  2890. -  * rs_open() and friends
  2891. -  * ------------------------------------------------------------
  2892. -  */
  2893. - static int block_til_ready( struct tty_struct *tty, struct file * filp,
  2894. -                             struct async_struct *info )
  2895. - {
  2896. -     struct wait_queue wait = { current, NULL };
  2897. -     int        retval;
  2898. -     int        do_clocal = C_CLOCAL(tty);
  2899. -     /*
  2900. -      * If the device is in the middle of being closed, then block
  2901. -      * until it's done, and then try again.
  2902. -      */
  2903. -     if (info->flags & ASYNC_CLOSING) {
  2904. -         interruptible_sleep_on(&info->close_wait);
  2905. - #ifdef SERIAL_DO_RESTART
  2906. -         if (info->flags & ASYNC_HUP_NOTIFY)
  2907. -             return -EAGAIN;
  2908. -         else
  2909. -             return -ERESTARTSYS;
  2910. - #else
  2911. -         return -EAGAIN;
  2912. - #endif
  2913. -     }
  2914. -     /*
  2915. -      * If this is a callout device, then just make sure the normal
  2916. -      * device isn't being used.
  2917. -      */
  2918. -     if (MAJOR(filp->f_rdev) == TTYAUX_MAJOR) {
  2919. -         if (info->flags & ASYNC_NORMAL_ACTIVE)
  2920. -             return -EBUSY;
  2921. -         if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  2922. -             (info->flags & ASYNC_SESSION_LOCKOUT) &&
  2923. -             (info->session != current->session))
  2924. -             return -EBUSY;
  2925. -         if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  2926. -             (info->flags & ASYNC_PGRP_LOCKOUT) &&
  2927. -             (info->pgrp != current->pgrp))
  2928. -             return -EBUSY;
  2929. -         info->flags |= ASYNC_CALLOUT_ACTIVE;
  2930. -         return 0;
  2931. -     }
  2932. -     
  2933. -     /*
  2934. -      * If non-blocking mode is set, then make the check up front
  2935. -      * and then exit.
  2936. -      */
  2937. -     if (filp->f_flags & O_NONBLOCK) {
  2938. -         if (info->flags & ASYNC_CALLOUT_ACTIVE)
  2939. -             return -EBUSY;
  2940. -         info->flags |= ASYNC_NORMAL_ACTIVE;
  2941. -         return 0;
  2942. -     }
  2943. -     /*
  2944. -      * Block waiting for the carrier detect and the line to become
  2945. -      * free (i.e., not in use by the callout).  While we are in
  2946. -      * this loop, info->count is dropped by one, so that
  2947. -      * rs_close() knows when to free things.  We restore it upon
  2948. -      * exit, either normal or abnormal.
  2949. -      */
  2950. -     retval = 0;
  2951. -     add_wait_queue(&info->open_wait, &wait);
  2952. - #ifdef SERIAL_DEBUG_OPEN
  2953. -     printk("block_til_ready before block: ttys%d, count = %d\n",
  2954. -            info->line, info->count);
  2955. - #endif
  2956. -     info->count--;
  2957. -     info->blocked_open++;
  2958. -     while (1) {
  2959. -         cli();
  2960. -         if (!(info->flags & ASYNC_CALLOUT_ACTIVE))
  2961. -             info->sw->set_modem_info( info, 1, 1 );
  2962. -         sti();
  2963. -         current->state = TASK_INTERRUPTIBLE;
  2964. -         if (tty_hung_up_p(filp) ||
  2965. -             !(info->flags & ASYNC_INITIALIZED)) {
  2966. - #ifdef SERIAL_DO_RESTART
  2967. -             if (info->flags & ASYNC_HUP_NOTIFY)
  2968. -                 retval = -EAGAIN;
  2969. -             else
  2970. -                 retval = -ERESTARTSYS;
  2971. - #else
  2972. -             retval = -EAGAIN;
  2973. - #endif
  2974. -             break;
  2975. -         }
  2976. -         if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
  2977. -             !(info->flags & ASYNC_CLOSING) &&
  2978. -             (do_clocal || (info->sw->get_modem_info( info ) & TIOCM_CAR)))
  2979. -             break;
  2980. -         if (current->signal & ~current->blocked) {
  2981. -             retval = -ERESTARTSYS;
  2982. -             break;
  2983. -         }
  2984. - #ifdef SERIAL_DEBUG_OPEN
  2985. -         printk("block_til_ready blocking: ttys%d, count = %d\n",
  2986. -                info->line, info->count);
  2987. - #endif
  2988. -         schedule();
  2989. -     }
  2990. -     current->state = TASK_RUNNING;
  2991. -     remove_wait_queue(&info->open_wait, &wait);
  2992. -     if (!tty_hung_up_p(filp))
  2993. -         info->count++;
  2994. -     info->blocked_open--;
  2995. - #ifdef SERIAL_DEBUG_OPEN
  2996. -     printk("block_til_ready after blocking: ttys%d, count = %d\n",
  2997. -            info->line, info->count);
  2998. - #endif
  2999. -     if (retval)
  3000. -         return retval;
  3001. -     info->flags |= ASYNC_NORMAL_ACTIVE;
  3002. -     return 0;
  3003. - }    
  3004. - /*
  3005. -  * This routine is called whenever a serial port is opened.
  3006. -  */
  3007. - int rs_open( struct tty_struct *tty, struct file * filp )
  3008. - {
  3009. -     struct async_struct    *info;
  3010. -     int                 retval, line;
  3011. -     line = DEV_TO_SL(tty->line);
  3012. -     if ((line < 0) || (line >= NR_PORTS))
  3013. -         return( -ENODEV );
  3014. -     info = rs_table + line;
  3015. -     if (!info->base)
  3016. -         return( -ENODEV );
  3017. - #ifdef SERIAL_DEBUG_OPEN
  3018. -     printk("rs_open ttyS%d, count = %d\n", info->line, info->count);
  3019. - #endif
  3020. -     info->count++;
  3021. -     info->tty = tty;
  3022. -     
  3023. -     tty->write       = rs_write;
  3024. -     tty->close       = rs_close;
  3025. -     tty->ioctl       = rs_ioctl;
  3026. -     tty->throttle    = rs_throttle;
  3027. -     tty->set_termios = rs_set_termios;
  3028. -     tty->stop        = rs_stop;
  3029. -     tty->start       = rs_start;
  3030. -     tty->hangup      = rs_hangup;
  3031. -     if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
  3032. -         if (MAJOR(filp->f_rdev) == TTY_MAJOR)
  3033. -             *tty->termios = info->normal_termios;
  3034. -         else 
  3035. -             *tty->termios = info->callout_termios;
  3036. -     }
  3037. -     /*
  3038. -      * Start up serial port
  3039. -      */
  3040. -     if ((retval = startup(info, 1))) return retval;
  3041. -     retval = block_til_ready(tty, filp, info);
  3042. -     if (retval) {
  3043. - #ifdef SERIAL_DEBUG_OPEN
  3044. -         printk( "rs_open returning after block_til_ready with %d\n", retval );
  3045. - #endif
  3046. -         return retval;
  3047. -     }
  3048. -     info->session = current->session;
  3049. -     info->pgrp = current->pgrp;
  3050. - #ifdef SERIAL_DEBUG_OPEN
  3051. -     printk("rs_open ttyS%d successfull...", info->line);
  3052. - #endif
  3053. -     return 0;
  3054. - }
  3055. - /*
  3056. -  * Boot-time initialization code: Init the serial ports present on
  3057. -  * this machine type.
  3058. -  *
  3059. -  * Current HW Port to minor/device name mapping:
  3060. -  *
  3061. -  *   TT                    | Falcon                    || minor | name
  3062. -  *  -----------------------+---------------------------++-------+-------
  3063. -  *   SCC B (Modem2)        | SCC B (Modem)             || 64    | ttyS0
  3064. -  *   SCC A (Serial2/LAN)   | SCC A (LAN)               || 65    | ttyS1
  3065. -  *   ST-MFP port (Modem1)  | --                        || 66    | ttyS2
  3066. -  *   TT-MFP port (Serial1) | ST-MFP port (no TOS name) || 67    | ttyS3
  3067. -  *
  3068. -  * The background of this mapping is that I wanted to assign the same
  3069. -  * minors to ports with the same capabilities. Staring with the MFPs
  3070. -  * would leave a hole in the first position on the Falcon!
  3071. -  *
  3072. -  * Should Serial2/LAN on the TT be split into two devices, selecting thus
  3073. -  * the connector used? Serial2 would be unassigned on the Falcon, and
  3074. -  * if one is open, opening the other would block.
  3075. -  * 
  3076. -  */
  3077. - long rs_init( long kmem_start )
  3078. - {    int                    i;
  3079. -     struct async_struct    *info;
  3080. -     if (boot_info.machtype != MACH_ATARI) return( kmem_start );
  3081. -     
  3082. -     memset( &rs_event, 0, sizeof(rs_event) );
  3083. -     bh_base[SERIAL_BH].routine = do_softint;
  3084. -     /* Initialize the async_struct's */
  3085. -     for( i = 0, info = rs_table; i < NR_PORTS; i++, info++ ) {
  3086. -         info->line           = i;
  3087. -         info->base             = NULL;
  3088. -         info->tty            = 0;
  3089. -         info->type           = PORT_UNKNOWN;
  3090. -         info->custom_divisor = 0;
  3091. -         info->close_delay    = 50;
  3092. -         info->x_char         = 0;
  3093. -         info->event          = 0;
  3094. -         info->count          = 0;
  3095. -         info->blocked_open   = 0;
  3096. -         memset(&info->callout_termios, 0, sizeof(struct termios));
  3097. -         memset(&info->normal_termios, 0, sizeof(struct termios));
  3098. -         info->open_wait      = 0;
  3099. -         info->xmit_wait      = 0;
  3100. -         info->close_wait     = 0;
  3101. -     }
  3102. -     /* Now initialize the ports themselves */
  3103. -     switch( boot_info.bi_atari.model ) {
  3104. -       case ATARI_TT:
  3105. -         atari_init_SCC(
  3106. -             &rs_table[0],
  3107. -             SCC_NORM,                        /* type */
  3108. -             1,                                /* Channel B */
  3109. -             (void *)&tt_mfp.par_dt_reg, 3, 0/* RI */
  3110. -         );
  3111. -         atari_init_SCC(
  3112. -             &rs_table[1],
  3113. -             SCC_DMA,                        /* type */
  3114. -             0,                                 /* Channel A */
  3115. -             0, 0, 0                            /* no RI */
  3116. -         );
  3117. -         atari_init_MFPser(
  3118. -             &rs_table[2],
  3119. -             MFP_CTRL,                        /* type */
  3120. -             0,                                /* ST-MFP */
  3121. -             (void *)&mfp.par_dt_reg, 6, 0    /* RI */
  3122. -         );
  3123. -         atari_init_MFPser(
  3124. -             &rs_table[3],
  3125. -             MFP_BARE,                        /* type */
  3126. -             1,                                /* TT_MFP */
  3127. -             0, 0, 0                            /* no RI */
  3128. -         );
  3129. -         break;
  3130. -         
  3131. -       case ATARI_FALCON:
  3132. -         atari_init_SCC(
  3133. -             &rs_table[0],
  3134. -             SCC_NORM,                        /* type */
  3135. -             1,                                /* Channel B */
  3136. -             (void *)&mfp.par_dt_reg, 6, 0    /* RI */
  3137. -         );
  3138. -         atari_init_SCC(
  3139. -             &rs_table[1],
  3140. -             SCC_NORM,                        /* type */
  3141. -             0,                                 /* Channel A */
  3142. -             0, 0, 0                            /* no RI */
  3143. -         );
  3144. -         atari_init_MFPser(
  3145. -             &rs_table[3],
  3146. -             MFP_BARE,                        /* type */
  3147. -             0,                                /* ST-MFP */
  3148. -             0, 0, 0                            /* no RI */
  3149. -         );
  3150. -         break;
  3151. -     }
  3152. -     return( kmem_start );
  3153. - }
  3154. --- 0 ----
  3155. diff -cr --new-file linux-0.9pl1/drivers/char/atari_serial.h linux-0.9pl2/drivers/char/atari_serial.h
  3156. *** linux-0.9pl1/drivers/char/atari_serial.h    Sun Jun 26 22:42:24 1994
  3157. --- linux-0.9pl2/drivers/char/atari_serial.h    Wed Dec 31 19:00:00 1969
  3158. ***************
  3159. *** 1,324 ****
  3160. - /*
  3161. -  * atari_serial.h: Common definitions for all Atari serial ports
  3162. -  *
  3163. -  * Copyright 1994 Roman Hodek
  3164. -  *   EMail: rnhodek@cip.informatik.uni-erlangen.de (Internet)
  3165. -  *      or: Roman_Hodek@n.maus.de (MausNet, NO mail > 16 KB!)
  3166. -  *
  3167. -  * This file is subject to the terms and conditions of the GNU General Public
  3168. -  * License.  See the file README.legal in the main directory of this archive
  3169. -  * for more details.
  3170. -  *
  3171. -  */
  3172. - #ifndef _ATARI_SERIAL_H
  3173. - #define _ATARI_SERIAL_H
  3174. - #include <linux/tty.h>
  3175. - /* 4 is sufficient for now... */
  3176. - #define    NR_PORTS 4
  3177. - /* Structure describing one bit in a register that may be high- or
  3178. -  * low-active. This is used for RI detection, because the location of
  3179. -  * this signal varies widely. The function TEST_BITPOS() is provided
  3180. -  * to return the status of such a bit.
  3181. -  */
  3182. - typedef struct {
  3183. -     volatile unsigned char    *addr;            /* address of register */
  3184. -     unsigned char            bitno;            /* bit#, 0..7 */
  3185. -     unsigned char            active_state;    /* 1 for high-active,
  3186. -                                              * 0 for * low-active */
  3187. - } BITPOS;
  3188. - static __inline__ int TEST_BITPOS( BITPOS bp )
  3189. - {
  3190. -     return( !bp.addr ? 0 :
  3191. -             !!(*(bp.addr) & (1 << bp.bitno)) == bp.active_state );
  3192. - }
  3193. -     
  3194. - /* Atari serial port types are numbered from 100 to avoid interference
  3195. -  * with the PC types (1..4)
  3196. -  */
  3197. - typedef enum {
  3198. -     SCC_NORM = 100,    /* standard SCC channel */
  3199. -     SCC_DMA,        /* SCC channel with DMA support */
  3200. -     MFP_CTRL,        /* standard MFP port with modem control signals */
  3201. -     MFP_BARE,        /* MFP port without modem controls */
  3202. - } SERTYPE;
  3203. - /* This function tables does the abstraction from the underlying
  3204. -  * hardware:
  3205. -  *
  3206. -  *   init(): Initialize the port as necessary, set RTS and DTR and
  3207. -  *      enable interrupts. It does not need to set the speed and other
  3208. -  *      parameters, because change_speed() is called, too.
  3209. -  *   deinit(): Stop the port (wait for all characters to be sent,
  3210. -  *      disable interrupts)
  3211. -  *   enab_tx_int(): Enable or disable the Tx Buffer Empty interrupt
  3212. -  *      independantly from other interrupt sources. The pointer to
  3213. -  *      this function may be NULL, if there is no way to do this or it
  3214. -  *      is too complex. This Tx ints are just disabled to save some
  3215. -  *      interrupts if the transmitter is stopped anyway.
  3216. -  *   check_custom_divisor(): Check the given custom divisor for legality
  3217. -  *      and return 0 if OK, non-zero otherwise.
  3218. -  *   change_speed(): Set port speed, character size, number of stop
  3219. -  *      bits and parity from the termios structure. If the user wants
  3220. -  *      to set the speed with a custom divisor, he is required to
  3221. -  *      check the baud_base first!
  3222. -  *   restart(): Is called every time new data arrived in the Tx queue
  3223. -  *      and may be used to restart the transmitter if it ran empty.
  3224. -  *      'c' is the first character to be output or -1 if there is
  3225. -  *      none. If more than one character can be written (FIFOs!), you
  3226. -  *      have to take the remaining ones from the write queue directly.
  3227. -  *      This function is called with interrupts off.
  3228. -  *   throttle(): Set or clear the RTS line according to 'status'.
  3229. -  *   set_break(): Set or clear the 'Send a Break' flag.
  3230. -  *   get_serial_info(): Fill in the baud_base and custom_divisor
  3231. -  *      fields of a serial_struct. It may also modify other fields, if
  3232. -  *      needed.
  3233. -  *   get_modem_info(): Return the status of RTS, DTR, DCD, RI, DSR and CTS.
  3234. -  *   set_modem_info(): Set the status of RTS and DTR according to
  3235. -  *      'new_dtr' and 'new_rts', resp. 0 = clear, 1 = set, -1 = don't change
  3236. -  *   ioctl(): Process any port-specific ioctl's. This pointer may be
  3237. -  *      NULL, if the port has no own ioctl's.
  3238. -  *
  3239. -  */
  3240. - struct async_struct;
  3241. - typedef struct {
  3242. -     void (*init)( struct async_struct *info );
  3243. -     void (*deinit)( struct async_struct *info, int leave_dtr );
  3244. -     void (*enab_tx_int)( struct async_struct *info, int enab_flag );
  3245. -     int  (*check_custom_divisor)( struct async_struct *info, int divisor );
  3246. -     void (*change_speed)( struct async_struct *info );
  3247. -     void (*restart)( struct async_struct *info, int c );
  3248. -     void (*throttle)( struct async_struct *info, int status );
  3249. -     void (*set_break)( struct async_struct *info, int break_flag );
  3250. -     void (*get_serial_info)( struct async_struct *info,
  3251. -                 struct serial_struct *retinfo );
  3252. -     unsigned int (*get_modem_info)( struct async_struct *info );
  3253. -     int  (*set_modem_info)( struct async_struct *info, int new_dtr,
  3254. -                    int new_rts );
  3255. -     int  (*ioctl)( struct tty_struct *tty, struct file *file,
  3256. -               struct async_struct *info, unsigned int cmd,
  3257. -               unsigned long arg );
  3258. - } SERIALSWITCH;
  3259. - /* This is a modified version of the PC-Linux async_struct. Mainly,
  3260. -  * stuff like port address, xmit_fifo_size and the like are left out
  3261. -  * and other information fields were added.
  3262. -  */
  3263. - struct async_struct {
  3264. -     /* Atari specific fields */
  3265. -     SERTYPE            type;         /* UART type */
  3266. -     volatile void        *base;        /* base address */
  3267. -     BITPOS            RI;            /* Where the Ring Indicator is signalled */
  3268. -     SERIALSWITCH        *sw;        /* functions to manage this port */
  3269. -     /* common fields */
  3270. -     int            flags;
  3271. -     struct tty_struct     *tty;
  3272. -     int            timeout;
  3273. -     int            custom_divisor;
  3274. -     int            x_char;        /* xon/xoff characater */
  3275. -     int            close_delay;
  3276. -     int            event;
  3277. -     int            line;
  3278. -     int            count;        /* # of fd on device */
  3279. -     int            blocked_open; /* # of blocked opens */
  3280. -     long            session;    /* Session of opening process */
  3281. -     long            pgrp;        /* pgrp of opening process */
  3282. -     struct termios        normal_termios;
  3283. -     struct termios        callout_termios;
  3284. -     struct wait_queue    *open_wait;
  3285. -     struct wait_queue    *close_wait;
  3286. -     struct wait_queue    *xmit_wait;
  3287. - };
  3288. - /*
  3289. -  * Events are used to schedule things to happen at timer-interrupt
  3290. -  * time, instead of at rs interrupt time.
  3291. -  */
  3292. - #define RS_EVENT_READ_PROCESS    0
  3293. - #define RS_EVENT_WRITE_WAKEUP    1
  3294. - #define RS_EVENT_HANGUP        2
  3295. - #define RS_EVENT_BREAK        3
  3296. - #define RS_EVENT_OPEN_WAKEUP    4
  3297. - /***************************** Prototypes *****************************/
  3298. - void rs_stop( struct tty_struct *tty );
  3299. - void rs_start( struct tty_struct *tty );
  3300. - void rs_write( struct tty_struct * tty );
  3301. - void rs_throttle( struct tty_struct * tty, int status );
  3302. - void rs_hangup( struct tty_struct *tty );
  3303. - int rs_open( struct tty_struct *tty, struct file * filp );
  3304. - long rs_init( long kmem_start );
  3305. - /************************* End of Prototypes **************************/
  3306. - /*************************** Inline Functions *************************/
  3307. - #include <linux/interrupt.h>
  3308. - #include <asm/bitops.h>
  3309. - /*
  3310. -  * This routine is used by the interrupt handler to schedule
  3311. -  * processing in the software interrupt portion of the driver.
  3312. -  * It is needed in the port-specific interrupt handlers, so it is
  3313. -  * declared here in the common header.
  3314. -  */
  3315. - extern char rs_event[];
  3316. - static inline void rs_sched_event( struct async_struct *info, int event )
  3317. - {
  3318. -     info->event |= 1 << event;
  3319. -     set_bit(info->line, rs_event);
  3320. -     mark_bh(SERIAL_BH);
  3321. - }
  3322. - /* The following functions do common tasks needed in the interrupt
  3323. -  * service routine(s):
  3324. -  * 
  3325. -  *  - Putting a character into the read_queue, either with or without
  3326. -  *    an error condition, and waking up processes waiting for
  3327. -  *    something to arrive
  3328. -  *  - Check if a throttle is needed due to the read queue getting full
  3329. -  *  - Removing a character from the write queue, obeying pending flow
  3330. -  *    control characters
  3331. -  *  - Checking for enough characters in the write queue to wake up
  3332. -  *    sleeping processes
  3333. -  *  - Doing required actions on wait queues if DCD has changed
  3334. -  *  - Doing required actions on wait queues if CTS has changed;
  3335. -  *    returns non-zero, if the transmitter should be restarted
  3336. -  */
  3337. - static __inline__ void rs_put_char_to_queue( struct async_struct *info,
  3338. -                         int c, int err )
  3339. - {    struct tty_queue    *q = &info->tty->read_q;
  3340. -     
  3341. -     if (!FULL(q)) {
  3342. -         if (err) {
  3343. -             if (err == TTY_BREAK)
  3344. -                 rs_sched_event( info, RS_EVENT_BREAK );
  3345. -             /* ignore parity errors if parity checking isn't enabled. */
  3346. -             if (!(err == TTY_PARITY && !I_INPCK(info->tty))) {
  3347. -                 set_bit( q->head, &info->tty->readq_flags );
  3348. -                 c = err;
  3349. -             }
  3350. -         }
  3351. -         q->buf[q->head] = c;
  3352. -         INC(q->head);
  3353. -         rs_sched_event( info, RS_EVENT_READ_PROCESS );
  3354. -     }
  3355. - }
  3356. - static __inline__ void rs_rx_throttle_if_needed( struct async_struct *info )
  3357. - {    struct tty_queue    *q = &info->tty->read_q;
  3358. -     if (LEFT(q) < RQ_THRESHOLD_LW &&
  3359. -         !set_bit( TTY_RQ_THROTTLED, &info->tty->flags))
  3360. -         rs_throttle( info->tty, TTY_THROTTLE_RQ_FULL );
  3361. - }
  3362. - static __inline__ int rs_get_char_from_queue( struct async_struct *info )
  3363. - {    int                    ch;
  3364. -     struct tty_queue    *q = &info->tty->write_q;
  3365. -     if (info->x_char) {
  3366. -         ch = info->x_char;
  3367. -         info->x_char = 0;
  3368. -     }
  3369. -     else if (!EMPTY(q)) {
  3370. -         ch = q->buf[q->tail];
  3371. -         INC(q->tail);
  3372. -     }
  3373. -     else {
  3374. -         rs_stop( info->tty );
  3375. -         ch = -1;
  3376. -     }
  3377. -     return( ch );
  3378. - }
  3379. - static __inline__ void rs_tx_wakeup_if_needed( struct async_struct *info )
  3380. - {    struct tty_queue    *q = &info->tty->write_q;
  3381. -     if (LEFT(q) > WAKEUP_CHARS) {
  3382. -         rs_sched_event( info, RS_EVENT_WRITE_WAKEUP );
  3383. -         if (info->tty->write_data_cnt) {
  3384. -             set_bit( info->tty->line, &tty_check_write );
  3385. -             mark_bh( TTY_BH );
  3386. -         }
  3387. -     }
  3388. - }
  3389. - static __inline__ void rs_dcd_changed( struct async_struct *info, int dcd )
  3390. - {
  3391. -     if (!C_CLOCAL(info->tty)) {
  3392. -         if (dcd)
  3393. -             rs_sched_event( info, RS_EVENT_OPEN_WAKEUP );
  3394. -         else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  3395. -                    (info->flags & ASYNC_CALLOUT_NOHUP)))
  3396. -             rs_sched_event( info, RS_EVENT_HANGUP );
  3397. -     }
  3398. - }
  3399. - static __inline__ int rs_cts_changed( struct async_struct *info, int cts )
  3400. - {
  3401. -     if (!C_CRTSCTS(info->tty) || (info->flags & ASYNC_CLOSING))
  3402. -         return( 0 );
  3403. -     if (info->tty->hw_stopped) {
  3404. -         if (cts) {
  3405. -             info->tty->hw_stopped = 0;
  3406. -             rs_start( info->tty );
  3407. -             return( 1 );
  3408. -         }
  3409. -     }
  3410. -     else {
  3411. -         if (!cts) {
  3412. -             info->tty->hw_stopped = 1;
  3413. -             rs_stop( info->tty );
  3414. -         }
  3415. -     }
  3416. -     return( 0 );
  3417. - }
  3418. - #endif /* _ATARI_SERIAL_H */
  3419. --- 0 ----
  3420. diff -cr --new-file linux-0.9pl1/drivers/char/console.c linux-0.9pl2/drivers/char/console.c
  3421. *** linux-0.9pl1/drivers/char/console.c    Sun Jun 26 19:05:29 1994
  3422. --- linux-0.9pl2/drivers/char/console.c    Sun Aug  7 16:27:39 1994
  3423. ***************
  3424. *** 405,411 ****
  3425.           case 1:    /* erase from start to cursor */
  3426.               /* 680x0 do in two stages */
  3427.               sw->con_clear(&vc_cons[currcons],0,0,y, video_num_columns);
  3428. !             sw->con_clear(&vc_cons[currcons],y,0,1,x);
  3429.               break;
  3430.           case 2: /* erase whole display */
  3431.               sw->con_clear(&vc_cons[currcons],0,0,video_num_lines, video_num_columns);
  3432. --- 405,411 ----
  3433.           case 1:    /* erase from start to cursor */
  3434.               /* 680x0 do in two stages */
  3435.               sw->con_clear(&vc_cons[currcons],0,0,y, video_num_columns);
  3436. !             sw->con_clear(&vc_cons[currcons],y,0,1,x + 1);
  3437.               break;
  3438.           case 2: /* erase whole display */
  3439.               sw->con_clear(&vc_cons[currcons],0,0,video_num_lines, video_num_columns);
  3440. ***************
  3441. *** 423,429 ****
  3442.               sw->con_clear(&vc_cons[currcons],y,x,1,video_num_columns-x);
  3443.               break;
  3444.           case 1:    /* erase from start of line to cursor */
  3445. !             sw->con_clear(&vc_cons[currcons],y,0,1,x);
  3446.               break;
  3447.           case 2: /* erase whole line */
  3448.               sw->con_clear(&vc_cons[currcons],y,0,1,video_num_columns);
  3449. --- 423,429 ----
  3450.               sw->con_clear(&vc_cons[currcons],y,x,1,video_num_columns-x);
  3451.               break;
  3452.           case 1:    /* erase from start of line to cursor */
  3453. !             sw->con_clear(&vc_cons[currcons],y,0,1,x + 1);
  3454.               break;
  3455.           case 2: /* erase whole line */
  3456.               sw->con_clear(&vc_cons[currcons],y,0,1,video_num_columns);
  3457. ***************
  3458. *** 683,689 ****
  3459.       /*
  3460.        * Print the erase char on the current position
  3461.        */
  3462. !     sw->con_putc(&vc_cons[currcons],(video_erase_char & 0x00ff),y,x,DM_COPY);
  3463.   
  3464.       need_wrap = 0;
  3465.   }
  3466. --- 683,689 ----
  3467.       /*
  3468.        * Print the erase char on the current position
  3469.        */
  3470. !     sw->con_putc(&vc_cons[currcons],(video_erase_char & 0x00ff),y,x,reverse ? DM_INVERSE : DM_COPY);
  3471.   
  3472.       need_wrap = 0;
  3473.   }
  3474. ***************
  3475. *** 698,704 ****
  3476.                  1, video_num_columns - x - nr);
  3477.       while (nr--)
  3478.         sw->con_putc (&vc_cons[currcons], video_erase_char & 0x00ff,
  3479. !             y, x + nr, DM_COPY);
  3480.       need_wrap = 0;
  3481.   }
  3482.   
  3483. --- 698,704 ----
  3484.                  1, video_num_columns - x - nr);
  3485.       while (nr--)
  3486.         sw->con_putc (&vc_cons[currcons], video_erase_char & 0x00ff,
  3487. !             y, x + nr, reverse ? DM_INVERSE : DM_COPY);
  3488.       need_wrap = 0;
  3489.   }
  3490.   
  3491. ***************
  3492. *** 724,730 ****
  3493.   
  3494.       while (nr--)
  3495.         sw->con_putc (&vc_cons[currcons], video_erase_char & 0x00ff,
  3496. !             y, video_num_columns - 1 - nr, DM_COPY);
  3497.   
  3498.       need_wrap = 0;
  3499.   }
  3500. --- 724,731 ----
  3501.   
  3502.       while (nr--)
  3503.         sw->con_putc (&vc_cons[currcons], video_erase_char & 0x00ff,
  3504. !             y, video_num_columns - 1 - nr, reverse ? DM_INVERSE
  3505. !             : DM_COPY);
  3506.   
  3507.       need_wrap = 0;
  3508.   }
  3509. ***************
  3510. *** 863,869 ****
  3511.   
  3512.                               if (nextx == cols) {
  3513.                                   sw->con_putc(&vc_cons[currcons],
  3514. !                                              *buf, y, x, DM_COPY);
  3515.                                   need_wrap = decawm;
  3516.                                   continue;
  3517.                               }
  3518. --- 864,871 ----
  3519.   
  3520.                               if (nextx == cols) {
  3521.                                   sw->con_putc(&vc_cons[currcons],
  3522. !                                              *buf, y, x, reverse ? DM_INVERSE
  3523. !                          : DM_COPY);
  3524.                                   need_wrap = decawm;
  3525.                                   continue;
  3526.                               }
  3527. ***************
  3528. *** 882,888 ****
  3529.                   }
  3530.   
  3531.                               sw->con_putcs(&vc_cons[currcons],
  3532. !                                           buf, count, y, x, DM_COPY);
  3533.                               if (nextx == cols) {
  3534.                                   x         = cols-1;
  3535.                                   need_wrap = decawm;
  3536. --- 884,891 ----
  3537.                   }
  3538.   
  3539.                               sw->con_putcs(&vc_cons[currcons],
  3540. !                                           buf, count, y, x, reverse ? DM_INVERSE
  3541. !                       : DM_COPY);
  3542.                               if (nextx == cols) {
  3543.                                   x         = cols-1;
  3544.                                   need_wrap = decawm;
  3545. ***************
  3546. *** 910,916 ****
  3547.                * 680x0: ignore attributes for now, just 
  3548.                * print character.
  3549.                */
  3550. !             sw->con_putc(&vc_cons[currcons],c,y,x,DM_COPY);
  3551.               if (x == video_num_columns - 1)
  3552.                   need_wrap = decawm;
  3553.               else {
  3554. --- 913,920 ----
  3555.                * 680x0: ignore attributes for now, just 
  3556.                * print character.
  3557.                */
  3558. !             sw->con_putc(&vc_cons[currcons],c,y,x,
  3559. !                      reverse ? DM_INVERSE : DM_COPY);
  3560.               if (x == video_num_columns - 1)
  3561.                   need_wrap = decawm;
  3562.               else {
  3563. ***************
  3564. *** 1162,1168 ****
  3565.                   if (c == '8') {
  3566.                       /* DEC screen alignment test. kludge :-) */
  3567.                       video_erase_char =
  3568. !                         (video_erase_char & 0x00ff) | 'E';
  3569.                       /* Arno:
  3570.                        * Doesn't work, because csi_J(c,2)
  3571.                        * calls con_clear and doesn't print
  3572. --- 1166,1172 ----
  3573.                   if (c == '8') {
  3574.                       /* DEC screen alignment test. kludge :-) */
  3575.                       video_erase_char =
  3576. !                         (video_erase_char & 0xff00) | 'E';
  3577.                       /* Arno:
  3578.                        * Doesn't work, because csi_J(c,2)
  3579.                        * calls con_clear and doesn't print
  3580. ***************
  3581. *** 1170,1176 ****
  3582.                        */
  3583.                       csi_J(currcons, 2);
  3584.                       video_erase_char =
  3585. !                         (video_erase_char & 0x00ff) | ' ';
  3586.                   }
  3587.                   continue;
  3588.               case ESsetG0:
  3589. --- 1174,1180 ----
  3590.                        */
  3591.                       csi_J(currcons, 2);
  3592.                       video_erase_char =
  3593. !                         (video_erase_char & 0xff00) | ' ';
  3594.                   }
  3595.                   continue;
  3596.               case ESsetG0:
  3597. ***************
  3598. *** 1271,1320 ****
  3599.          sw->con_putcs(&vc_cons[currcons], start, count ,
  3600.                        y, x, DM_COPY);
  3601.          x += count;
  3602. !        if (x == video_num_columns - 1)
  3603.              need_wrap = 1;
  3604.      }
  3605.      
  3606.      set_cursor(currcons);
  3607.   }
  3608. - #if 0   /* Arno's old putc based version */
  3609. - void console_print(const char * b)
  3610. - {
  3611. -     int currcons = fg_console;
  3612. -     unsigned char c;
  3613. -     if (!printable || currcons<0 || currcons>=NR_CONSOLES)
  3614. -         return;
  3615. -     while ((c = *(b++)) != 0) {
  3616. -         if (c == 10 || c == 13 || need_wrap) {
  3617. -             if (c != 13)
  3618. -                 lf(currcons);
  3619. -             cr(currcons);
  3620. -             if (c == 10 || c == 13)
  3621. -                 continue;
  3622. -         }
  3623. -         sw->con_putc(&vc_cons[currcons],c,y,x,DM_COPY);
  3624. -         if (x == video_num_columns - 1) {
  3625. -             need_wrap = 1;
  3626. -             continue;
  3627. -         }
  3628. -         x++;
  3629. -     }
  3630. -     set_cursor(currcons);
  3631. -     return;
  3632. -     if (vt_cons[fg_console].vc_mode == KD_GRAPHICS)
  3633. -         return;
  3634. -     timer_active &= ~(1<<BLANK_TIMER);
  3635. -     if (console_blanked) {
  3636. -         timer_table[BLANK_TIMER].expires = 0;
  3637. -         timer_active |= 1<<BLANK_TIMER;
  3638. -     } else if (blankinterval) {
  3639. -         timer_table[BLANK_TIMER].expires = jiffies + blankinterval;
  3640. -         timer_active |= 1<<BLANK_TIMER;
  3641. -     }
  3642. - }
  3643. - #endif
  3644.   
  3645.   
  3646.   /*
  3647. --- 1275,1289 ----
  3648.          sw->con_putcs(&vc_cons[currcons], start, count ,
  3649.                        y, x, DM_COPY);
  3650.          x += count;
  3651. !        if (x == video_num_columns)
  3652. !      {
  3653. !        x--;
  3654.              need_wrap = 1;
  3655. +      }
  3656.      }
  3657.      
  3658.      set_cursor(currcons);
  3659.   }
  3660.   
  3661.   
  3662.   /*
  3663. diff -cr --new-file linux-0.9pl1/drivers/char/defkeymap.c.old linux-0.9pl2/drivers/char/defkeymap.c.old
  3664. *** linux-0.9pl1/drivers/char/defkeymap.c.old    Tue Jun  7 19:39:16 1994
  3665. --- linux-0.9pl2/drivers/char/defkeymap.c.old    Wed Dec 31 19:00:00 1969
  3666. ***************
  3667. *** 1,399 ****
  3668. - /* Automatically generated by mktable */
  3669. - /* Do not edit this file!             */
  3670. - #include <linux/types.h>
  3671. - #include <linux/keyboard.h>
  3672. - #include <linux/kd.h>
  3673. - u_short key_map[NR_KEYMAPS][NR_KEYS] = {
  3674. -     {
  3675. -     0x0200,    0x001b,    0x0031,    0x0032,    0x0033,    0x0034,    0x0035,    0x0036,    
  3676. -     0x0037,    0x0038,    0x0039,    0x0030,    0x002d,    0x003d,    0x007f,    0x0009,    
  3677. -     0x0b71,    0x0b77,    0x0b65,    0x0b72,    0x0b74,    0x0b79,    0x0b75,    0x0b69,    
  3678. -     0x0b6f,    0x0b70,    0x005b,    0x005d,    0x0201,    0x0702,    0x0b61,    0x0b73,    
  3679. -     0x0b64,    0x0b66,    0x0b67,    0x0b68,    0x0b6a,    0x0b6b,    0x0b6c,    0x003b,    
  3680. -     0x0027,    0x0060,    0x0700,    0x005c,    0x0b7a,    0x0b78,    0x0b63,    0x0b76,    
  3681. -     0x0b62,    0x0b6e,    0x0b6d,    0x002c,    0x002e,    0x002f,    0x0700,    0x030c,    
  3682. -     0x0703,    0x0020,    0x0207,    0x0100,    0x0101,    0x0102,    0x0103,    0x0104,    
  3683. -     0x0105,    0x0106,    0x0107,    0x0108,    0x0109,    0x0208,    0x0209,    0x0307,    
  3684. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3685. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x003c,    0x010a,    
  3686. -     0x010b,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3687. -     0x030e,    0x0702,    0x030d,    0x001c,    0x0701,    0x0205,    0x0114,    0x0603,    
  3688. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3689. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3690. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3691. -     }, {
  3692. -     0x0200,    0x001b,    0x0021,    0x0040,    0x0023,    0x0024,    0x0025,    0x005e,    
  3693. -     0x0026,    0x002a,    0x0028,    0x0029,    0x005f,    0x002b,    0x007f,    0x0009,    
  3694. -     0x0b51,    0x0b57,    0x0b45,    0x0b52,    0x0b54,    0x0b59,    0x0b55,    0x0b49,    
  3695. -     0x0b4f,    0x0b50,    0x007b,    0x007d,    0x0201,    0x0702,    0x0b41,    0x0b53,    
  3696. -     0x0b44,    0x0b46,    0x0b47,    0x0b48,    0x0b4a,    0x0b4b,    0x0b4c,    0x003a,    
  3697. -     0x0022,    0x007e,    0x0700,    0x007c,    0x0b5a,    0x0b58,    0x0b43,    0x0b56,    
  3698. -     0x0b42,    0x0b4e,    0x0b4d,    0x003c,    0x003e,    0x003f,    0x0700,    0x030c,    
  3699. -     0x0703,    0x0020,    0x0207,    0x010a,    0x010b,    0x010c,    0x010d,    0x010e,    
  3700. -     0x010f,    0x0110,    0x0111,    0x0112,    0x0113,    0x0208,    0x0203,    0x0307,    
  3701. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3702. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x003e,    0x010a,    
  3703. -     0x010b,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3704. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3705. -     0x020b,    0x0601,    0x0602,    0x0117,    0x0600,    0x020a,    0x0115,    0x0116,    
  3706. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3707. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3708. -     }, {
  3709. -     0x0200,    0x0200,    0x0200,    0x0040,    0x0200,    0x0024,    0x0200,    0x0200,    
  3710. -     0x007b,    0x005b,    0x005d,    0x007d,    0x005c,    0x0200,    0x0200,    0x0200,    
  3711. -     0x0b71,    0x0b77,    0x0b65,    0x0b72,    0x0b74,    0x0b79,    0x0b75,    0x0b69,    
  3712. -     0x0b6f,    0x0b70,    0x0200,    0x007e,    0x0201,    0x0702,    0x0b61,    0x0b73,    
  3713. -     0x0b64,    0x0b66,    0x0b67,    0x0b68,    0x0b6a,    0x0b6b,    0x0b6c,    0x0200,    
  3714. -     0x0200,    0x0200,    0x0700,    0x0200,    0x0b7a,    0x0b78,    0x0b63,    0x0b76,    
  3715. -     0x0b62,    0x0b6e,    0x0b6d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3716. -     0x0703,    0x0200,    0x0207,    0x050c,    0x050d,    0x050e,    0x050f,    0x0510,    
  3717. -     0x0511,    0x0512,    0x0513,    0x0514,    0x0515,    0x0208,    0x0202,    0x0307,    
  3718. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3719. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x007c,    0x0516,    
  3720. -     0x0517,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3721. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3722. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3723. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3724. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3725. -     }, {
  3726. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3727. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3728. -     0x0b51,    0x0b57,    0x0b45,    0x0b52,    0x0b54,    0x0b59,    0x0b55,    0x0b49,    
  3729. -     0x0b4f,    0x0b50,    0x0200,    0x0200,    0x0201,    0x0702,    0x0b41,    0x0b53,    
  3730. -     0x0b44,    0x0b46,    0x0b47,    0x0b48,    0x0b4a,    0x0b4b,    0x0b4c,    0x0200,    
  3731. -     0x0200,    0x0200,    0x0700,    0x0200,    0x0b5a,    0x0b58,    0x0b43,    0x0b56,    
  3732. -     0x0b42,    0x0b4e,    0x0b4d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3733. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3734. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3735. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3736. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3737. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3738. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3739. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3740. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3741. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3742. -     }, {
  3743. -     0x0200,    0x0200,    0x0200,    0x0000,    0x001b,    0x001c,    0x001d,    0x001e,    
  3744. -     0x001f,    0x007f,    0x0200,    0x0200,    0x001f,    0x0200,    0x0200,    0x0200,    
  3745. -     0x0011,    0x0017,    0x0005,    0x0012,    0x0014,    0x0019,    0x0015,    0x0009,    
  3746. -     0x000f,    0x0010,    0x001b,    0x001d,    0x0201,    0x0702,    0x0001,    0x0013,    
  3747. -     0x0004,    0x0006,    0x0007,    0x0008,    0x000a,    0x000b,    0x000c,    0x0200,    
  3748. -     0x0007,    0x0000,    0x0700,    0x001c,    0x001a,    0x0018,    0x0003,    0x0016,    
  3749. -     0x0002,    0x000e,    0x000d,    0x0200,    0x020e,    0x007f,    0x0700,    0x030c,    
  3750. -     0x0703,    0x0000,    0x0207,    0x0100,    0x0101,    0x0102,    0x0103,    0x0104,    
  3751. -     0x0105,    0x0106,    0x0107,    0x0108,    0x0109,    0x0208,    0x0204,    0x0307,    
  3752. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3753. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x010a,    
  3754. -     0x010b,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3755. -     0x030e,    0x0702,    0x030d,    0x001c,    0x0701,    0x0205,    0x0114,    0x0603,    
  3756. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3757. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3758. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3759. -     }, {
  3760. -     0x0200,    0x0200,    0x0200,    0x0000,    0x0200,    0x0200,    0x0200,    0x0200,    
  3761. -     0x0200,    0x0200,    0x0200,    0x0200,    0x001f,    0x0200,    0x0200,    0x0200,    
  3762. -     0x0011,    0x0017,    0x0005,    0x0012,    0x0014,    0x0019,    0x0015,    0x0009,    
  3763. -     0x000f,    0x0010,    0x0200,    0x0200,    0x0201,    0x0702,    0x0001,    0x0013,    
  3764. -     0x0004,    0x0006,    0x0007,    0x0008,    0x000a,    0x000b,    0x000c,    0x0200,    
  3765. -     0x0200,    0x0200,    0x0700,    0x0200,    0x001a,    0x0018,    0x0003,    0x0016,    
  3766. -     0x0002,    0x000e,    0x000d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3767. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3768. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3769. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3770. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3771. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3772. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3773. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3774. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3775. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3776. -     }, {
  3777. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3778. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3779. -     0x0011,    0x0017,    0x0005,    0x0012,    0x0014,    0x0019,    0x0015,    0x0009,    
  3780. -     0x000f,    0x0010,    0x0200,    0x0200,    0x0201,    0x0702,    0x0001,    0x0013,    
  3781. -     0x0004,    0x0006,    0x0007,    0x0008,    0x000a,    0x000b,    0x000c,    0x0200,    
  3782. -     0x0200,    0x0200,    0x0700,    0x0200,    0x001a,    0x0018,    0x0003,    0x0016,    
  3783. -     0x0002,    0x000e,    0x000d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3784. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3785. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3786. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3787. -     0x0302,    0x0303,    0x0300,    0x020c,    0x0206,    0x0200,    0x0200,    0x0200,    
  3788. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3789. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3790. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x020c,    
  3791. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3792. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3793. -     }, {
  3794. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3795. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3796. -     0x0011,    0x0017,    0x0005,    0x0012,    0x0014,    0x0019,    0x0015,    0x0009,    
  3797. -     0x000f,    0x0010,    0x0200,    0x0200,    0x0201,    0x0702,    0x0001,    0x0013,    
  3798. -     0x0004,    0x0006,    0x0007,    0x0008,    0x000a,    0x000b,    0x000c,    0x0200,    
  3799. -     0x0200,    0x0200,    0x0700,    0x0200,    0x001a,    0x0018,    0x0003,    0x0016,    
  3800. -     0x0002,    0x000e,    0x000d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3801. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3802. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3803. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3804. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3805. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3806. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3807. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3808. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3809. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3810. -     }, {
  3811. -     0x0200,    0x081b,    0x0831,    0x0832,    0x0833,    0x0834,    0x0835,    0x0836,    
  3812. -     0x0837,    0x0838,    0x0839,    0x0830,    0x082d,    0x083d,    0x087f,    0x0809,    
  3813. -     0x0871,    0x0877,    0x0865,    0x0872,    0x0874,    0x0879,    0x0875,    0x0869,    
  3814. -     0x086f,    0x0870,    0x085b,    0x085d,    0x080d,    0x0702,    0x0861,    0x0873,    
  3815. -     0x0864,    0x0866,    0x0867,    0x0868,    0x086a,    0x086b,    0x086c,    0x083b,    
  3816. -     0x0827,    0x0860,    0x0700,    0x085c,    0x087a,    0x0878,    0x0863,    0x0876,    
  3817. -     0x0862,    0x086e,    0x086d,    0x082c,    0x082e,    0x082f,    0x0700,    0x030c,    
  3818. -     0x0703,    0x0820,    0x0207,    0x0500,    0x0501,    0x0502,    0x0503,    0x0504,    
  3819. -     0x0505,    0x0506,    0x0507,    0x0508,    0x0509,    0x0208,    0x0209,    0x0907,    
  3820. -     0x0908,    0x0909,    0x030b,    0x0904,    0x0905,    0x0906,    0x030a,    0x0901,    
  3821. -     0x0902,    0x0903,    0x0900,    0x0310,    0x0206,    0x0200,    0x083c,    0x050a,    
  3822. -     0x050b,    0x0200,    0x0200,    0x0808,    0x0200,    0x0200,    0x0200,    0x0200,    
  3823. -     0x030e,    0x0702,    0x030d,    0x001c,    0x0701,    0x0205,    0x0114,    0x0603,    
  3824. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3825. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3826. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3827. -     }, {
  3828. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3829. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3830. -     0x0851,    0x0857,    0x0845,    0x0852,    0x0854,    0x0859,    0x0855,    0x0849,    
  3831. -     0x084f,    0x0850,    0x0200,    0x0200,    0x0201,    0x0702,    0x0841,    0x0853,    
  3832. -     0x0844,    0x0846,    0x0847,    0x0848,    0x084a,    0x084b,    0x084c,    0x0200,    
  3833. -     0x0200,    0x0200,    0x0700,    0x0200,    0x085a,    0x0858,    0x0843,    0x0856,    
  3834. -     0x0842,    0x084e,    0x084d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3835. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3836. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3837. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3838. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3839. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3840. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3841. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3842. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3843. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3844. -     }, {
  3845. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3846. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3847. -     0x0871,    0x0877,    0x0865,    0x0872,    0x0874,    0x0879,    0x0875,    0x0869,    
  3848. -     0x086f,    0x0870,    0x0200,    0x0200,    0x0201,    0x0702,    0x0861,    0x0873,    
  3849. -     0x0864,    0x0866,    0x0867,    0x0868,    0x086a,    0x086b,    0x086c,    0x0200,    
  3850. -     0x0200,    0x0200,    0x0700,    0x0200,    0x087a,    0x0878,    0x0863,    0x0876,    
  3851. -     0x0862,    0x086e,    0x086d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3852. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3853. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3854. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3855. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3856. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3857. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3858. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3859. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3860. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3861. -     }, {
  3862. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3863. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3864. -     0x0851,    0x0857,    0x0845,    0x0852,    0x0854,    0x0859,    0x0855,    0x0849,    
  3865. -     0x084f,    0x0850,    0x0200,    0x0200,    0x0201,    0x0702,    0x0841,    0x0853,    
  3866. -     0x0844,    0x0846,    0x0847,    0x0848,    0x084a,    0x084b,    0x084c,    0x0200,    
  3867. -     0x0200,    0x0200,    0x0700,    0x0200,    0x085a,    0x0858,    0x0843,    0x0856,    
  3868. -     0x0842,    0x084e,    0x084d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3869. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3870. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3871. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3872. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3873. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3874. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3875. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3876. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3877. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3878. -     }, {
  3879. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3880. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3881. -     0x0811,    0x0817,    0x0805,    0x0812,    0x0814,    0x0819,    0x0815,    0x0809,    
  3882. -     0x080f,    0x0810,    0x0200,    0x0200,    0x0201,    0x0702,    0x0801,    0x0813,    
  3883. -     0x0804,    0x0806,    0x0807,    0x0808,    0x080a,    0x080b,    0x080c,    0x0200,    
  3884. -     0x0200,    0x0200,    0x0700,    0x0200,    0x081a,    0x0818,    0x0803,    0x0816,    
  3885. -     0x0802,    0x080e,    0x080d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3886. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3887. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3888. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3889. -     0x0302,    0x0303,    0x0300,    0x020c,    0x0206,    0x0200,    0x0200,    0x0200,    
  3890. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3891. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3892. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x020c,    
  3893. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3894. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3895. -     }, {
  3896. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3897. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3898. -     0x0811,    0x0817,    0x0805,    0x0812,    0x0814,    0x0819,    0x0815,    0x0809,    
  3899. -     0x080f,    0x0810,    0x0200,    0x0200,    0x0201,    0x0702,    0x0801,    0x0813,    
  3900. -     0x0804,    0x0806,    0x0807,    0x0808,    0x080a,    0x080b,    0x080c,    0x0200,    
  3901. -     0x0200,    0x0200,    0x0700,    0x0200,    0x081a,    0x0818,    0x0803,    0x0816,    
  3902. -     0x0802,    0x080e,    0x080d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3903. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3904. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3905. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3906. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3907. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3908. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3909. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3910. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3911. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3912. -     }, {
  3913. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3914. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3915. -     0x0811,    0x0817,    0x0805,    0x0812,    0x0814,    0x0819,    0x0815,    0x0809,    
  3916. -     0x080f,    0x0810,    0x0200,    0x0200,    0x0201,    0x0702,    0x0801,    0x0813,    
  3917. -     0x0804,    0x0806,    0x0807,    0x0808,    0x080a,    0x080b,    0x080c,    0x0200,    
  3918. -     0x0200,    0x0200,    0x0700,    0x0200,    0x081a,    0x0818,    0x0803,    0x0816,    
  3919. -     0x0802,    0x080e,    0x080d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3920. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3921. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3922. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3923. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3924. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3925. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3926. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3927. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3928. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3929. -     }, {
  3930. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3931. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3932. -     0x0811,    0x0817,    0x0805,    0x0812,    0x0814,    0x0819,    0x0815,    0x0809,    
  3933. -     0x080f,    0x0810,    0x0200,    0x0200,    0x0201,    0x0702,    0x0801,    0x0813,    
  3934. -     0x0804,    0x0806,    0x0807,    0x0808,    0x080a,    0x080b,    0x080c,    0x0200,    
  3935. -     0x0200,    0x0200,    0x0700,    0x0200,    0x081a,    0x0818,    0x0803,    0x0816,    
  3936. -     0x0802,    0x080e,    0x080d,    0x0200,    0x0200,    0x0200,    0x0700,    0x030c,    
  3937. -     0x0703,    0x0200,    0x0207,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3938. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0208,    0x0200,    0x0307,    
  3939. -     0x0308,    0x0309,    0x030b,    0x0304,    0x0305,    0x0306,    0x030a,    0x0301,    
  3940. -     0x0302,    0x0303,    0x0300,    0x0310,    0x0206,    0x0200,    0x0200,    0x0200,    
  3941. -     0x0200,    0x0200,    0x0200,    0x0008,    0x0200,    0x0200,    0x0200,    0x0200,    
  3942. -     0x030e,    0x0702,    0x030d,    0x0200,    0x0701,    0x0205,    0x0114,    0x0603,    
  3943. -     0x0118,    0x0601,    0x0602,    0x0117,    0x0600,    0x0119,    0x0115,    0x0116,    
  3944. -     0x011a,    0x010c,    0x010d,    0x011b,    0x011c,    0x0110,    0x0311,    0x011d,    
  3945. -     0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    0x0200,    
  3946. -     }, 
  3947. - };
  3948. - char func_buf[FUNC_BUFSIZE] = {
  3949. -     '\033', '[', '[', 'A', 0, 
  3950. -     '\033', '[', '[', 'B', 0, 
  3951. -     '\033', '[', '[', 'C', 0, 
  3952. -     '\033', '[', '[', 'D', 0, 
  3953. -     '\033', '[', '[', 'E', 0, 
  3954. -     '\033', '[', '1', '7', '~', 0, 
  3955. -     '\033', '[', '1', '8', '~', 0, 
  3956. -     '\033', '[', '1', '9', '~', 0, 
  3957. -     '\033', '[', '2', '0', '~', 0, 
  3958. -     '\033', '[', '2', '1', '~', 0, 
  3959. -     '\033', '[', '2', '3', '~', 0, 
  3960. -     '\033', '[', '2', '4', '~', 0, 
  3961. -     '\033', '[', '2', '5', '~', 0, 
  3962. -     '\033', '[', '2', '6', '~', 0, 
  3963. -     '\033', '[', '2', '8', '~', 0, 
  3964. -     '\033', '[', '2', '9', '~', 0, 
  3965. -     '\033', '[', '3', '1', '~', 0, 
  3966. -     '\033', '[', '3', '2', '~', 0, 
  3967. -     '\033', '[', '3', '3', '~', 0, 
  3968. -     '\033', '[', '3', '4', '~', 0, 
  3969. -     '\033', '[', '1', '~', 0, 
  3970. -     '\033', '[', '2', '~', 0, 
  3971. -     '\033', '[', '3', '~', 0, 
  3972. -     '\033', '[', '4', '~', 0, 
  3973. -     '\033', '[', '5', '~', 0, 
  3974. -     '\033', '[', '6', '~', 0, 
  3975. -     '\033', '[', 'M', 0, 
  3976. -     0, 
  3977. -     0, 
  3978. -     '\033', '[', 'P', 0, 
  3979. -     0, 
  3980. -     0, 
  3981. -     0, 
  3982. -     0, 
  3983. -     0, 
  3984. -     0, 
  3985. - };
  3986. - char *func_table[NR_FUNC] = {
  3987. -     func_buf + 0,
  3988. -     func_buf + 5,
  3989. -     func_buf + 10,
  3990. -     func_buf + 15,
  3991. -     func_buf + 20,
  3992. -     func_buf + 25,
  3993. -     func_buf + 31,
  3994. -     func_buf + 37,
  3995. -     func_buf + 43,
  3996. -     func_buf + 49,
  3997. -     func_buf + 55,
  3998. -     func_buf + 61,
  3999. -     func_buf + 67,
  4000. -     func_buf + 73,
  4001. -     func_buf + 79,
  4002. -     func_buf + 85,
  4003. -     func_buf + 91,
  4004. -     func_buf + 97,
  4005. -     func_buf + 103,
  4006. -     func_buf + 109,
  4007. -     func_buf + 115,
  4008. -     func_buf + 120,
  4009. -     func_buf + 125,
  4010. -     func_buf + 130,
  4011. -     func_buf + 135,
  4012. -     func_buf + 140,
  4013. -     func_buf + 145,
  4014. -     func_buf + 149,
  4015. -     func_buf + 150,
  4016. -     func_buf + 151,
  4017. -     func_buf + 155,
  4018. -     func_buf + 156,
  4019. -     func_buf + 157,
  4020. -     func_buf + 158,
  4021. -     func_buf + 159,
  4022. -     func_buf + 160,
  4023. - };
  4024. - struct kbdiacr accent_table[MAX_DIACR] = {
  4025. -     {'`', 'A', '\300'},    {'`', 'a', '\340'},
  4026. -     {'\'', 'A', '\301'},    {'\'', 'a', '\341'},
  4027. -     {'^', 'A', '\302'},    {'^', 'a', '\342'},
  4028. -     {'~', 'A', '\303'},    {'~', 'a', '\343'},
  4029. -     {'"', 'A', '\304'},    {'"', 'a', '\344'},
  4030. -     {'O', 'A', '\305'},    {'o', 'a', '\345'},
  4031. -     {'0', 'A', '\305'},    {'0', 'a', '\345'},
  4032. -     {'A', 'A', '\305'},    {'a', 'a', '\345'},
  4033. -     {'A', 'E', '\306'},    {'a', 'e', '\346'},
  4034. -     {',', 'C', '\307'},    {',', 'c', '\347'},
  4035. -     {'`', 'E', '\310'},    {'`', 'e', '\350'},
  4036. -     {'\'', 'E', '\311'},    {'\'', 'e', '\351'},
  4037. -     {'^', 'E', '\312'},    {'^', 'e', '\352'},
  4038. -     {'"', 'E', '\313'},    {'"', 'e', '\353'},
  4039. -     {'`', 'I', '\314'},    {'`', 'i', '\354'},
  4040. -     {'\'', 'I', '\315'},    {'\'', 'i', '\355'},
  4041. -     {'^', 'I', '\316'},    {'^', 'i', '\356'},
  4042. -     {'"', 'I', '\317'},    {'"', 'i', '\357'},
  4043. -     {'-', 'D', '\320'},    {'-', 'd', '\360'},
  4044. -     {'~', 'N', '\321'},    {'~', 'n', '\361'},
  4045. -     {'`', 'O', '\322'},    {'`', 'o', '\362'},
  4046. -     {'\'', 'O', '\323'},    {'\'', 'o', '\363'},
  4047. -     {'^', 'O', '\324'},    {'^', 'o', '\364'},
  4048. -     {'~', 'O', '\325'},    {'~', 'o', '\365'},
  4049. -     {'"', 'O', '\326'},    {'"', 'o', '\366'},
  4050. -     {'/', 'O', '\330'},    {'/', 'o', '\370'},
  4051. -     {'`', 'U', '\331'},    {'`', 'u', '\371'},
  4052. -     {'\'', 'U', '\332'},    {'\'', 'u', '\372'},
  4053. -     {'^', 'U', '\333'},    {'^', 'u', '\373'},
  4054. -     {'"', 'U', '\334'},    {'"', 'u', '\374'},
  4055. -     {'\'', 'Y', '\335'},    {'\'', 'y', '\375'},
  4056. -     {'T', 'H', '\336'},    {'t', 'h', '\376'},
  4057. -     {'s', 's', '\337'},    {'"', 'y', '\377'},
  4058. -     {'s', 'z', '\337'},    {'i', 'j', '\377'},
  4059. - };
  4060. - unsigned int accent_table_size = 68;
  4061. --- 0 ----
  4062. diff -cr --new-file linux-0.9pl1/drivers/char/lp.c linux-0.9pl2/drivers/char/lp.c
  4063. *** linux-0.9pl1/drivers/char/lp.c    Tue Jun  7 19:39:17 1994
  4064. --- linux-0.9pl2/drivers/char/lp.c    Sat Aug  6 19:51:24 1994
  4065. ***************
  4066. *** 1,5 ****
  4067. --- 1,6 ----
  4068.   /*
  4069.    * Amiga printer device by Michael Rausch (linux@uni-koblenz.de);
  4070. +  * Atari support added by Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de);
  4071.    * based upon work from
  4072.    *
  4073.    * Copyright (C) 1992 by Jim Weigand and Linus Torvalds
  4074. ***************
  4075. *** 9,18 ****
  4076. --- 10,32 ----
  4077.    * Copyright (C) 1993 by Nigel Gamble (added interrupt code)
  4078.    */
  4079.   
  4080. + #include <linux/config.h>
  4081.   #include <linux/errno.h>
  4082.   #include <linux/kernel.h>
  4083.   #include <linux/major.h>
  4084.   #include <linux/sched.h>
  4085. + #ifdef CONFIG_AMIGA
  4086. + #include <linux/amigahw.h>
  4087. + #include <linux/amigaints.h>
  4088. + #endif
  4089. + #ifdef CONFIG_ATARI
  4090. + #include <linux/delay.h>
  4091. + #include <linux/atarihw.h>
  4092. + #include <linux/atariints.h>
  4093. + #endif
  4094.   #include <linux/lp.h>
  4095.   #include <linux/malloc.h>
  4096.   #include <linux/interrupt.h>
  4097. ***************
  4098. *** 20,27 ****
  4099.   #include <asm/segment.h>
  4100.   #include <asm/system.h>
  4101.   
  4102. - #include <linux/amigahw.h>
  4103. - #include <linux/amigaints.h>
  4104.   
  4105.   /*
  4106.    *  why bother around with the pio driver when the interrupt works;
  4107. --- 34,39 ----
  4108. ***************
  4109. *** 55,61 ****
  4110.           count ++;
  4111.           if(need_resched)
  4112.               schedule();
  4113. !     } while(LP_IS_BUSY && count < LP_CHAR);
  4114.   
  4115.       if (count == LP_CHAR) {
  4116.           return 0;
  4117. --- 67,73 ----
  4118.           count ++;
  4119.           if(need_resched)
  4120.               schedule();
  4121. !     } while(LP_IS_BUSY() && count < LP_CHAR);
  4122.   
  4123.       if (count == LP_CHAR) {
  4124.           return 0;
  4125. ***************
  4126. *** 82,88 ****
  4127.   #if WHICH_DRIVER != FORCE_POLLING
  4128.   static int lp_char_interrupt(char lpchar)
  4129.   {
  4130. !     if (!LP_IS_BUSY) {
  4131.           LP_OUT(lpchar);
  4132.           return 1;
  4133.       }
  4134. --- 94,100 ----
  4135.   #if WHICH_DRIVER != FORCE_POLLING
  4136.   static int lp_char_interrupt(char lpchar)
  4137.   {
  4138. !     if (!LP_IS_BUSY()) {
  4139.           LP_OUT(lpchar);
  4140.           return 1;
  4141.       }
  4142. ***************
  4143. *** 159,173 ****
  4144.               if(copy_size) {
  4145.                   int rc = total_bytes_written + bytes_written;
  4146.   
  4147. !                 if (LP_HAS_POUT) {
  4148.                       printk("lp0: out of paper\n");
  4149.                       if (!rc)
  4150.                           rc = -ENOSPC;
  4151. !                 } else if (!LP_IS_ONLINE) {
  4152.                       printk("lp0: off-line\n");
  4153.                       if (!rc)
  4154.                           rc = -EIO;
  4155. !                 } else if (LP_IS_BUSY) {
  4156.                       printk("lp0: printer error\n");
  4157.                       if (!rc)
  4158.                           rc = -EIO;
  4159. --- 171,185 ----
  4160.               if(copy_size) {
  4161.                   int rc = total_bytes_written + bytes_written;
  4162.   
  4163. !                 if (LP_HAS_POUT()) {
  4164.                       printk("lp0: out of paper\n");
  4165.                       if (!rc)
  4166.                           rc = -ENOSPC;
  4167. !                 } else if (!LP_IS_ONLINE()) {
  4168.                       printk("lp0: off-line\n");
  4169.                       if (!rc)
  4170.                           rc = -EIO;
  4171. !                 } else if (LP_IS_BUSY()) {
  4172.                       printk("lp0: printer error\n");
  4173.                       if (!rc)
  4174.                           rc = -EIO;
  4175. ***************
  4176. *** 227,233 ****
  4177.               lp_total_chars++;
  4178.   #endif
  4179.           } else { /* if printer timed out */
  4180. !             if (LP_HAS_POUT) {
  4181.                   printk("lp0: out of paper\n");
  4182.                   if(LP_F & LP_ABORT)
  4183.                       return temp-buf?temp-buf:-ENOSPC;
  4184. --- 239,245 ----
  4185.               lp_total_chars++;
  4186.   #endif
  4187.           } else { /* if printer timed out */
  4188. !             if (LP_HAS_POUT()) {
  4189.                   printk("lp0: out of paper\n");
  4190.                   if(LP_F & LP_ABORT)
  4191.                       return temp-buf?temp-buf:-ENOSPC;
  4192. ***************
  4193. *** 235,241 ****
  4194.                   current->timeout = jiffies + LP_TIMEOUT_POLLED;
  4195.                   schedule();
  4196.               } else
  4197. !             if (!LP_IS_ONLINE) {
  4198.                   printk("lp0: off-line\n");
  4199.                   if(LP_F & LP_ABORT)
  4200.                       return temp-buf?temp-buf:-EIO;
  4201. --- 247,253 ----
  4202.                   current->timeout = jiffies + LP_TIMEOUT_POLLED;
  4203.                   schedule();
  4204.               } else
  4205. !             if (!LP_IS_ONLINE()) {
  4206.                   printk("lp0: off-line\n");
  4207.                   if(LP_F & LP_ABORT)
  4208.                       return temp-buf?temp-buf:-EIO;
  4209. ***************
  4210. *** 244,250 ****
  4211.                   schedule();
  4212.               } else
  4213.                       /* not offline or out of paper. on fire? */
  4214. !             if (LP_IS_BUSY) {
  4215.                   printk("lp0: on fire\n");
  4216.                   if(LP_F & LP_ABORT)
  4217.                       return temp-buf?temp-buf:-EFAULT;
  4218. --- 256,262 ----
  4219.                   schedule();
  4220.               } else
  4221.                       /* not offline or out of paper. on fire? */
  4222. !             if (LP_IS_BUSY()) {
  4223.                   printk("lp0: on fire\n");
  4224.                   if(LP_F & LP_ABORT)
  4225.                       return temp-buf?temp-buf:-EFAULT;
  4226. ***************
  4227. *** 302,309 ****
  4228.   
  4229.       LP_F |= LP_BUSY;
  4230.   
  4231. !     ciaa.ddrb = 0xff;    /* set the correct data directions */
  4232. !     ciab.ddra &= 0xf8;    /* maybe changed in some plip code */
  4233.   
  4234.       return 0;
  4235.   }
  4236. --- 314,337 ----
  4237.   
  4238.       LP_F |= LP_BUSY;
  4239.   
  4240. ! #ifdef CONFIG_AMIGA
  4241. !     if (boot_info.machtype == MACH_AMIGA)
  4242. !       {
  4243. !         ciaa.ddrb = 0xff;    /* set the correct data directions */
  4244. !         ciab.ddra &= 0xf8;    /* maybe changed in some plip code */
  4245. !       }
  4246. ! #endif
  4247. ! #ifdef CONFIG_ATARI
  4248. !     if (boot_info.machtype == MACH_ATARI)
  4249. !       {
  4250. !         /* Setup IO ports as output */
  4251. !         cli ();
  4252. !         sound_ym.rd_data_reg_sel = 7;
  4253. !         sound_ym.wd_data = (sound_ym.rd_data_reg_sel & 0x3f) | 0xc0;
  4254. !         sti ();
  4255. !       }
  4256. ! #endif
  4257.   
  4258.       return 0;
  4259.   }
  4260. ***************
  4261. *** 375,385 ****
  4262.       printk("lp_init: lp0 using polling driver\n");
  4263.   #else
  4264.   
  4265. !     if((lp_table.irq = mach_add_isr(IRQ_AMIGA_CIAA_FLG, (isrfunc)lp_interrupt, 0, NULL)))
  4266.       {
  4267.           lp_table.lp_buffer = (char*)kmem_start;
  4268.           kmem_start += LP_BUFFER_SIZE;
  4269. !         printk("lp_init: lp0 using cia interrupt\n");
  4270.       }
  4271.       else
  4272.   
  4273. --- 403,422 ----
  4274.       printk("lp_init: lp0 using polling driver\n");
  4275.   #else
  4276.   
  4277. ! #ifdef CONFIG_AMIGA
  4278. !     if (boot_info.machtype == MACH_AMIGA)
  4279. !       lp_table.irq = mach_add_isr(IRQ_AMIGA_CIAA_FLG, (isrfunc)lp_interrupt, 0, NULL);
  4280. ! #endif
  4281. ! #ifdef CONFIG_ATARI
  4282. !     if (boot_info.machtype == MACH_ATARI)
  4283. !       lp_table.irq = mach_add_isr (IRQ_MFP_BUSY, (isrfunc) lp_interrupt, 0, NULL);
  4284. ! #endif
  4285. !     if (lp_table.irq)
  4286.       {
  4287.           lp_table.lp_buffer = (char*)kmem_start;
  4288.           kmem_start += LP_BUFFER_SIZE;
  4289. !         printk("lp_init: lp0 using interrupt\n");
  4290.       }
  4291.       else
  4292.   
  4293. ***************
  4294. *** 387,396 ****
  4295.           printk("lp_init: lp0 using polling driver\n");
  4296.   #else
  4297.       {
  4298. !         printk("cannot get cia interrupt for lp0, and polling driver not configured.\n");
  4299.           return kmem_start;
  4300.       }
  4301.   #endif
  4302.   #endif
  4303.   
  4304.       LP_F |= LP_EXIST;
  4305. --- 424,439 ----
  4306.           printk("lp_init: lp0 using polling driver\n");
  4307.   #else
  4308.       {
  4309. !         printk("cannot get interrupt for lp0, and polling driver not configured.\n");
  4310.           return kmem_start;
  4311.       }
  4312.   #endif
  4313. + #endif
  4314. + #ifdef CONFIG_ATARI
  4315. +     if (boot_info.machtype == MACH_ATARI)
  4316. +         /* Enable interrupts */
  4317. +         mfp.int_en_b |= 1;
  4318.   #endif
  4319.   
  4320.       LP_F |= LP_EXIST;
  4321. diff -cr --new-file linux-0.9pl1/drivers/char/mem.c linux-0.9pl2/drivers/char/mem.c
  4322. *** linux-0.9pl1/drivers/char/mem.c    Tue Jun  7 19:39:17 1994
  4323. --- linux-0.9pl2/drivers/char/mem.c    Fri Aug  5 12:46:55 1994
  4324. ***************
  4325. *** 394,400 ****
  4326.   #endif
  4327.   #if defined (CONFIG_BUSMOUSE) || defined (CONFIG_82C710_MOUSE) || \
  4328.       defined (CONFIG_PSMOUSE) || defined (CONFIG_MS_BUSMOUSE) || \
  4329. !     defined (CONFIG_ATIXL_BUSMOUSE) || defined (CONFIG_AMIGAMOUSE)
  4330.       mem_start = mouse_init(mem_start);
  4331.   #endif
  4332.   /*
  4333. --- 394,401 ----
  4334.   #endif
  4335.   #if defined (CONFIG_BUSMOUSE) || defined (CONFIG_82C710_MOUSE) || \
  4336.       defined (CONFIG_PSMOUSE) || defined (CONFIG_MS_BUSMOUSE) || \
  4337. !     defined (CONFIG_ATIXL_BUSMOUSE) || defined (CONFIG_AMIGAMOUSE) || \
  4338. !     defined (CONFIG_ATARIMOUSE)
  4339.       mem_start = mouse_init(mem_start);
  4340.   #endif
  4341.   /*
  4342. diff -cr --new-file linux-0.9pl1/drivers/char/serial.c linux-0.9pl2/drivers/char/serial.c
  4343. *** linux-0.9pl1/drivers/char/serial.c    Tue Jun  7 19:39:19 1994
  4344. --- linux-0.9pl2/drivers/char/serial.c    Sun Aug  7 12:05:49 1994
  4345. ***************
  4346. *** 1,18 ****
  4347.   #include <linux/types.h>
  4348. ! #include <linux/fs.h>
  4349. ! #include <linux/tty.h>
  4350.   #include <linux/errno.h>
  4351.   
  4352. ! struct file;
  4353. ! struct tty_struct;
  4354.   
  4355. - int rs_open(struct tty_struct *tty, struct file * filp)
  4356.   {
  4357. !         return -EIO;
  4358.   }
  4359.   
  4360. ! long rs_init(long kmem_start)
  4361.   {
  4362. !         return kmem_start;
  4363.   }
  4364.   
  4365. --- 1,1002 ----
  4366. + /*
  4367. +  * drivers/char/serial.c: Common source file for Linux/68k serial drivers
  4368. +  *
  4369. +  * Copyright 1994 Roman Hodek
  4370. +  *   EMail: rnhodek@cip.informatik.uni-erlangen.de (Internet)
  4371. +  *      or: Roman_Hodek@n.maus.de (MausNet, NO mail > 16 KB!)
  4372. +  *
  4373. +  * Partially based on PC-Linux serial.c by Linus Torvalds and Theodore Ts'o
  4374. +  * 
  4375. +  * This file is subject to the terms and conditions of the GNU General Public
  4376. +  * License.  See the file README.legal in the main directory of this archive
  4377. +  * for more details.
  4378. +  *
  4379. +  */
  4380. + /*
  4381. +  * Notes and Design Goals:
  4382. +  * -----------------------
  4383. +  * The PC serial drivers can rely on the fact that all the serial
  4384. +  * hardware is very similar to program for all ports. Unfortunately,
  4385. +  * this is not true for the Atari. Here it is nearly the other way
  4386. +  * round: All ports need different treatment for the low-level stuff.
  4387. +  *
  4388. +  * For this reason, I split the serial driver code into a
  4389. +  * port-independent part (atari_serial.c) and port-specific parts
  4390. +  * (atari_*.c). The first manages all what can be done without
  4391. +  * accessing the hardware directly, i.e. interfacing with the
  4392. +  * high-level tty drivers, wait queues, managing the existing ports
  4393. +  * and the like. The latter do the actual hardware programming and are
  4394. +  * accessed by the hardware-independant part by a "switch" structure,
  4395. +  * that contains pointers to functions for specific tasks. See the
  4396. +  * comment before the definition of the SERIALSWITCH structure in
  4397. +  * atari_serial.h for more details.
  4398. +  *
  4399. +  * Despite its name, the port-independant code should be usable by
  4400. +  * other machines than Atari, too, if there are similar circumstances
  4401. +  * with different serial port hardware. Feel free to use it, but
  4402. +  * please inform me if you have to do changes to it. I'll try to keep
  4403. +  * it really device-independant. 
  4404. +  *
  4405. +  * Note: Hamish Macdonald, August 1994.
  4406. +  *  Modified to support the Amiga serial port also.  Files were renamed
  4407. +  *  to "serial.c" and "serial.h" at that time.
  4408. +  *
  4409. +  */
  4410. + #include <linux/config.h>
  4411.   #include <linux/types.h>
  4412. ! #include <linux/sched.h>
  4413. ! #include <linux/timer.h>
  4414.   #include <linux/errno.h>
  4415. + #include <linux/string.h>
  4416. + #include <linux/bootinfo.h>
  4417. + #include <linux/tty.h>
  4418. + #include <linux/termios.h>
  4419. + #include <linux/major.h>
  4420. + #include <linux/fcntl.h>
  4421. + #include <asm/bitops.h>
  4422. + #include <asm/segment.h>
  4423. + #include "serial.h"
  4424. + #ifdef CONFIG_ATARI
  4425. + #include "atari_SCC.h"
  4426. + #include "atari_MFPser.h"
  4427. + #endif
  4428. + #ifdef CONFIG_AMIGA
  4429. + void amiga_serinit ( struct async_struct * );
  4430. + #endif
  4431. + struct async_struct rs_table[ NR_PORTS ];
  4432. + char rs_event[ (NR_PORTS + 7) / 8 ];
  4433. + /***************************** Prototypes *****************************/
  4434. + static inline void handle_rs_break( struct async_struct *info );
  4435. + static void do_softint( void *unused );
  4436. + static int startup( struct async_struct * info, int get_irq );
  4437. + static void shutdown( struct async_struct * info, int do_free_irq );
  4438. + static int get_serial_info( struct async_struct * info, struct
  4439. +                             serial_struct * retinfo );
  4440. + static int set_serial_info( struct async_struct * info, struct
  4441. +                             serial_struct * new_info );
  4442. + static int get_modem_info( struct async_struct * info, unsigned int *value
  4443. +                            );
  4444. + static int set_modem_info( struct async_struct * info, unsigned int cmd,
  4445. +                            unsigned int *value );
  4446. + static void send_break( struct async_struct * info, int duration );
  4447. + static int rs_ioctl( struct tty_struct *tty, struct file * file, unsigned
  4448. +                      int cmd, unsigned long arg );
  4449. + static void rs_set_termios( struct tty_struct *tty, struct termios
  4450. +                             *old_termios );
  4451. + static void rs_close( struct tty_struct *tty, struct file * filp );
  4452. + static int block_til_ready( struct tty_struct *tty, struct file * filp,
  4453. +                             struct async_struct *info );
  4454. + /************************* End of Prototypes **************************/
  4455. + /*
  4456. +  * ------------------------------------------------------------
  4457. +  * rs_stop() and rs_start()
  4458. +  *
  4459. +  * This routines are called before setting or resetting tty->stopped.
  4460. +  * They enable or disable transmitter interrupts, as necessary.
  4461. +  * ------------------------------------------------------------ */
  4462. + void rs_stop( struct tty_struct *tty )
  4463. + {
  4464. +     struct async_struct *info;
  4465. +     
  4466. +     info = rs_table + DEV_TO_SL(tty->line);
  4467. +     if (info->flags & ASYNC_CLOSING) {
  4468. +         tty->stopped = 0;
  4469. +         tty->hw_stopped = 0;
  4470. +         return;
  4471. +     }
  4472. +     if (info->sw->enab_tx_int)
  4473. +         info->sw->enab_tx_int( info, 0 );
  4474. + }
  4475. + void rs_start( struct tty_struct *tty )
  4476. + {
  4477. +     struct async_struct *info;
  4478. +     info = rs_table + DEV_TO_SL(tty->line);
  4479. +     
  4480. +     if (info->sw->enab_tx_int) {
  4481. +         info->sw->enab_tx_int( info, 1 );
  4482. +     }
  4483. + }
  4484. + /*
  4485. +  * This routine is called when we receive a break on a serial line.
  4486. +  * It is executed out of the software interrupt routine.
  4487. +  */
  4488. + static inline void handle_rs_break( struct async_struct *info )
  4489. + {
  4490. +     if (info->flags & ASYNC_SAK)
  4491. +         do_SAK(info->tty);
  4492. +         
  4493. +     if (!I_IGNBRK(info->tty) && I_BRKINT(info->tty)) {
  4494. +         flush_input(info->tty);
  4495. +         flush_output(info->tty);
  4496. +         if (info->tty->pgrp > 0)
  4497. +             kill_pg(info->tty->pgrp, SIGINT, 1 );
  4498. +     }
  4499. + }
  4500. + /*
  4501. +  * This routine is used to handle the "bottom half" processing for the
  4502. +  * serial driver, known also the "software interrupt" processing.
  4503. +  * This processing is done at the kernel interrupt level, after the
  4504. +  * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON.  This
  4505. +  * is where time-consuming activities which can not be done in the
  4506. +  * interrupt driver proper are done; the interrupt driver schedules
  4507. +  * them using rs_sched_event(), and they get done here.
  4508. +  */
  4509. + static void do_softint( void *unused )
  4510. + {
  4511. +     int            i;
  4512. +     struct async_struct    *info;
  4513. +     
  4514. +     for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
  4515. +         if (clear_bit(i, rs_event)) {
  4516. +             if (!info->tty)    
  4517. +                 continue;
  4518. +             if (clear_bit(RS_EVENT_READ_PROCESS, &info->event)) {
  4519. +                 TTY_READ_FLUSH(info->tty);
  4520. +             }
  4521. +             if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
  4522. +                 wake_up_interruptible(&info->tty->write_q.proc_list);
  4523. +             }
  4524. +             if (clear_bit(RS_EVENT_HANGUP, &info->event)) {
  4525. +                 tty_hangup(info->tty);
  4526. +                 wake_up_interruptible(&info->open_wait);
  4527. +                 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
  4528. +             }
  4529. +             if (clear_bit(RS_EVENT_BREAK, &info->event))
  4530. +                 handle_rs_break(info);
  4531. +             if (clear_bit(RS_EVENT_OPEN_WAKEUP, &info->event)) {
  4532. +                 wake_up_interruptible(&info->open_wait);
  4533. +             }
  4534. +         }
  4535. +     }
  4536. + }
  4537. + static int startup( struct async_struct * info, int get_irq )
  4538. + {
  4539. +     unsigned long flags;
  4540. +     if (info->flags & ASYNC_INITIALIZED)
  4541. +         return 0;
  4542. +     if (!info->base || !info->type) {
  4543. +         if (info->tty)
  4544. +             set_bit(TTY_IO_ERROR, &info->tty->flags);
  4545. +         return 0;
  4546. +     }
  4547. +     save_flags(flags); cli();
  4548. + #ifdef SERIAL_DEBUG_OPEN
  4549. +     printk("starting up ttyS%d ...", info->line);
  4550. + #endif
  4551. +     info->sw->init( info );
  4552. +     if (info->tty)
  4553. +         clear_bit(TTY_IO_ERROR, &info->tty->flags);
  4554. +     /*
  4555. +      * Set the speed and other port parameters.
  4556. +      */
  4557. +     info->sw->change_speed( info );
  4558. +     info->flags |= ASYNC_INITIALIZED;
  4559. +     restore_flags(flags);
  4560. +     return 0;
  4561. + }
  4562. + /*
  4563. +  * This routine will shutdown a serial port; interrupts are disabled, and
  4564. +  * DTR is dropped if the hangup on close termio flag is on.
  4565. +  */
  4566. + static void shutdown( struct async_struct * info, int do_free_irq )
  4567. + {
  4568. +     unsigned long flags;
  4569. +     if (!(info->flags & ASYNC_INITIALIZED))
  4570. +         return;
  4571. + #ifdef SERIAL_DEBUG_OPEN
  4572. +     printk("Shutting down serial port %d ....", info->line);
  4573. + #endif
  4574. +     
  4575. +     save_flags(flags); cli(); /* Disable interrupts */
  4576. +     
  4577. +     info->sw->deinit( info, info->tty &&
  4578. +              !(info->tty->termios->c_cflag & HUPCL) );
  4579. +     
  4580. +     if (info->tty)
  4581. +         set_bit(TTY_IO_ERROR, &info->tty->flags);
  4582. +     
  4583. +     info->flags &= ~ASYNC_INITIALIZED;
  4584. +     restore_flags(flags);
  4585. + }
  4586. + /*
  4587. +  * ------------------------------------------------------------
  4588. +  * rs_write() and friends
  4589. +  * ------------------------------------------------------------
  4590. +  */
  4591. + /*
  4592. +  * This routine gets called when tty_write has put something into
  4593. +  * the write_queue.  
  4594. +  */
  4595. + void rs_write( struct tty_struct * tty )
  4596. + {    struct async_struct *info;
  4597. +     if (!tty || tty->stopped || tty->hw_stopped)
  4598. +         return;
  4599. +     info = rs_table + DEV_TO_SL(tty->line);
  4600. +     
  4601. +     cli();
  4602. +     if (!info || !info->tty || !(info->flags & ASYNC_INITIALIZED)) {
  4603. +             sti();
  4604. +         return;
  4605. +     }
  4606. +     if (info->sw->enab_tx_int)
  4607. +         info->sw->enab_tx_int( info, 1 );
  4608. +     info->sw->restart( info );
  4609. +     sti();
  4610. + }
  4611. + /*
  4612. +  * ------------------------------------------------------------
  4613. +  * rs_throttle()
  4614. +  * 
  4615. +  * This routine is called by the upper-layer tty layer to signal that
  4616. +  * incoming characters should be throttled (and that the throttle
  4617. +  * should be released).
  4618. +  * ------------------------------------------------------------
  4619. +  */
  4620. + void rs_throttle( struct tty_struct * tty, int status )
  4621. + {
  4622. +     struct async_struct *info;
  4623. +     unsigned long flags;
  4624. +     save_flags(flags); cli();
  4625. + #if SERIAL_DEBUG_THROTTLE
  4626. +     printk("throttle tty%d: %d (%d, %d)....\n", DEV_TO_SL(tty->line),
  4627. +            status, LEFT(&tty->read_q), LEFT(&tty->secondary));
  4628. + #endif
  4629. +     switch( status ) {
  4630. +       case TTY_THROTTLE_RQ_FULL:
  4631. +         info = rs_table + DEV_TO_SL(tty->line);
  4632. +         if (I_IXOFF(tty))
  4633. +             info->x_char = STOP_CHAR(tty);
  4634. +         else if (C_CRTSCTS(tty))
  4635. +             info->sw->throttle( info, status );
  4636. +         break;
  4637. +       case TTY_THROTTLE_RQ_AVAIL:
  4638. +         info = rs_table + DEV_TO_SL(tty->line);
  4639. +         if (I_IXOFF(tty)) {
  4640. +             if (info->x_char)
  4641. +                 info->x_char = 0;
  4642. +             else
  4643. +                 info->x_char = START_CHAR(tty);
  4644. +         } else if (C_CRTSCTS(tty))
  4645. +             info->sw->throttle( info, status );
  4646. +         break;
  4647. +     }
  4648. +     restore_flags(flags);
  4649. + }
  4650. + /*
  4651. +  * ------------------------------------------------------------
  4652. +  * rs_ioctl() and friends
  4653. +  * ------------------------------------------------------------
  4654. +  */
  4655. + static int get_serial_info (struct async_struct * info,
  4656. +                 struct serial_struct * retinfo )
  4657. + {
  4658. +     struct serial_struct tmp;
  4659. +   
  4660. +     if (!retinfo)
  4661. +     return -EFAULT;
  4662. +     /* Set port-independant data */
  4663. +     memset(&tmp, 0, sizeof(tmp));
  4664. +     tmp.type        = info->type;
  4665. +     tmp.line        = info->line;
  4666. +     tmp.port        = 0;    /* meaningless for non-Intel */
  4667. +     tmp.irq         = 0;    /* meaningless for Atari */
  4668. +     tmp.flags       = info->flags;
  4669. +     tmp.close_delay = info->close_delay;
  4670. +     tmp.hub6        = 0;    /* meaningless for Atari */
  4671. +     /* At least baud_base and costum_divisor set by port-specific
  4672. +      * function
  4673. +      */
  4674. +     info->sw->get_serial_info( info, &tmp );
  4675. +     
  4676. +     memcpy_tofs( retinfo, &tmp, sizeof(*retinfo) );
  4677. +     return 0;
  4678. + }
  4679.   
  4680. ! static int set_serial_info( struct async_struct * info,
  4681. !                             struct serial_struct * new_info )
  4682.   
  4683.   {
  4684. !     struct serial_struct    new_serial;
  4685. !     struct async_struct     old_info;
  4686. !     
  4687. !     if (!new_info) return( -EFAULT );
  4688. !     memcpy_fromfs( &new_serial, new_info, sizeof(new_serial) );
  4689. !     old_info = *info;
  4690. !     /* The fields type, line, port, irq, xmit_fifo_size, baud_base and
  4691. !      * hub6 of new_info are silently ignored for the Atari, since they
  4692. !      * are meaningless or cannot be changed, resp. Is this right or
  4693. !      * should an error be returned?
  4694. !      */
  4695. !     /* If a new custom divisor is to be set, let it check by the
  4696. !      * hardware specific code first!
  4697. !      */
  4698. !     if (new_serial.custom_divisor != info->custom_divisor) {
  4699. !         if (info->sw->check_custom_divisor( info, new_serial.custom_divisor ))
  4700. !             return( -EINVAL );
  4701. !     }
  4702. !     
  4703. !     if (!suser()) {
  4704. !         if ((new_serial.close_delay != info->close_delay) ||
  4705. !             ((new_serial.flags & ~ASYNC_USR_MASK) !=
  4706. !              (info->flags & ~ASYNC_USR_MASK))) return( -EPERM );
  4707. !         info->flags = ((info->flags & ~ASYNC_USR_MASK) |
  4708. !                        (new_serial.flags & ASYNC_USR_MASK));
  4709. !         info->custom_divisor = new_serial.custom_divisor;
  4710. !         goto check_and_exit;
  4711. !     }
  4712. !     /*
  4713. !      * OK, past this point, all the error checking has been done.
  4714. !      * At this point, we start making changes.....
  4715. !      */
  4716. !     info->flags = ((info->flags & ~ASYNC_FLAGS) |
  4717. !                    (new_serial.flags & ASYNC_FLAGS));
  4718. !     info->custom_divisor = new_serial.custom_divisor;
  4719. !     info->close_delay = new_serial.close_delay;
  4720. ! check_and_exit:
  4721. !     if (info->flags & ASYNC_INITIALIZED) {
  4722. !         if (((old_info.flags & ASYNC_SPD_MASK) !=
  4723. !              (info->flags & ASYNC_SPD_MASK)) ||
  4724. !             (old_info.custom_divisor != info->custom_divisor))
  4725. !             info->sw->change_speed( info ); 
  4726. !     }
  4727. !     else
  4728. !         (void)startup( info, 0 );
  4729. !     return 0;
  4730. ! }
  4731. ! static int get_modem_info (struct async_struct * info,
  4732. !                unsigned int *value )
  4733. ! {
  4734. !     unsigned int result;
  4735. !     result = info->sw->get_modem_info( info );
  4736. !     put_fs_long( result, (unsigned long *) value );
  4737. !     return 0;
  4738. ! }
  4739. ! static int set_modem_info (struct async_struct * info, unsigned int cmd,
  4740. !                unsigned int *value)
  4741. ! {
  4742. !     unsigned    arg = get_fs_long((unsigned long *) value);
  4743. !     int        new_dtr = -1, new_rts = -1;
  4744. !     
  4745. !     switch( cmd ) {
  4746. !       case TIOCMBIS:
  4747. !     if (arg & TIOCM_DTR) new_dtr = 1;
  4748. !     if (arg & TIOCM_RTS) new_rts = 1;
  4749. !     break;
  4750. !       case TIOCMBIC:
  4751. !     if (arg & TIOCM_DTR) new_dtr = 0;
  4752. !     if (arg & TIOCM_RTS) new_rts = 0;
  4753. !     break;
  4754. !       case TIOCMSET:
  4755. !     new_dtr = !!(arg & TIOCM_DTR);
  4756. !     new_rts = !!(arg & TIOCM_RTS);
  4757. !     break;
  4758. !       default:
  4759. !     return( -EINVAL );
  4760. !     }
  4761. !     
  4762. !     return( info->sw->set_modem_info( info, new_dtr, new_rts ) );
  4763. ! }
  4764. ! /*
  4765. !  * This routine sends a break out the serial port.
  4766. !  */
  4767. ! static void send_break(    struct async_struct * info, int duration )
  4768. ! {
  4769. !     if (!info->base) return;
  4770. !     
  4771. !     current->state = TASK_INTERRUPTIBLE;
  4772. !     current->timeout = jiffies + duration;
  4773. !     cli();
  4774. !     info->sw->set_break( info, 1 );
  4775. !     schedule();
  4776. !     info->sw->set_break( info, 0 );
  4777. !     sti();
  4778.   }
  4779.   
  4780. ! static int rs_ioctl( struct tty_struct *tty, struct file * file,
  4781. !                      unsigned int cmd, unsigned long arg )
  4782.   {
  4783. !     int error, line;
  4784. !     struct async_struct * info;
  4785. !     line = DEV_TO_SL(tty->line);
  4786. !     if (line < 0 || line >= NR_PORTS)
  4787. !         return -ENODEV;
  4788. !     info = rs_table + line;
  4789. !     if (!info->base) return( -ENODEV );
  4790. !     
  4791. !     switch( cmd ) {
  4792. !       case TCSBRK:    /* SVID version: non-zero arg --> no break */
  4793. !         if (!arg)
  4794. !             send_break(info, HZ/4);    /* 1/4 second */
  4795. !         return 0;
  4796. !       case TCSBRKP:    /* support for POSIX tcsendbreak() */
  4797. !         send_break(info, arg ? arg*(HZ/10) : HZ/4);
  4798. !         return 0;
  4799. !       case TIOCGSOFTCAR:
  4800. !         error = verify_area(VERIFY_WRITE, (void *) arg,sizeof(long));
  4801. !         if (error)
  4802. !             return error;
  4803. !         put_fs_long(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg);
  4804. !         return 0;
  4805. !       case TIOCSSOFTCAR:
  4806. !         arg = get_fs_long((unsigned long *) arg);
  4807. !         tty->termios->c_cflag =
  4808. !             ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
  4809. !         return 0;
  4810. !       case TIOCMGET:
  4811. !         error = verify_area(VERIFY_WRITE, (void *) arg,
  4812. !                     sizeof(unsigned int));
  4813. !         if (error)
  4814. !             return error;
  4815. !         return get_modem_info(info, (unsigned int *) arg);
  4816. !       case TIOCMBIS:
  4817. !       case TIOCMBIC:
  4818. !       case TIOCMSET:
  4819. !         return set_modem_info(info, cmd, (unsigned int *) arg);
  4820. !       case TIOCGSERIAL:
  4821. !         error = verify_area(VERIFY_WRITE, (void *) arg,
  4822. !                     sizeof(struct serial_struct));
  4823. !         if (error)
  4824. !             return error;
  4825. !         return get_serial_info(info, (struct serial_struct *) arg);
  4826. !       case TIOCSSERIAL:
  4827. !         return set_serial_info(info, (struct serial_struct *) arg);
  4828. !       case TIOCSERCONFIG:
  4829. !         /* return do_autoconfig(info); */
  4830. !         return( 0 );
  4831. !         
  4832. !       default:
  4833. !         if (info->sw->ioctl)
  4834. !             return( info->sw->ioctl( tty, file, info, cmd, arg ) );
  4835. !         else
  4836. !             return( -EINVAL );
  4837. !     }
  4838. !     return 0;
  4839.   }
  4840.   
  4841. + static void rs_set_termios( struct tty_struct *tty,
  4842. +                             struct termios *old_termios )
  4843. + {
  4844. +     struct async_struct *info;
  4845. +     if (tty->termios->c_cflag == old_termios->c_cflag)
  4846. +         return;
  4847. +     info = &rs_table[DEV_TO_SL(tty->line)];
  4848. +     info->sw->change_speed( info );
  4849. +     
  4850. +     if ((old_termios->c_cflag & CRTSCTS) &&
  4851. +         !(tty->termios->c_cflag & CRTSCTS)) {
  4852. +         tty->hw_stopped = 0;
  4853. +         rs_write(tty);
  4854. +     }
  4855. +     if (!(old_termios->c_cflag & CLOCAL) &&
  4856. +         (tty->termios->c_cflag & CLOCAL))
  4857. +         wake_up_interruptible(&info->open_wait);
  4858. + }
  4859. + /*
  4860. +  * ------------------------------------------------------------
  4861. +  * rs_close()
  4862. +  * 
  4863. +  * This routine is called when the serial port gets closed.  First, we
  4864. +  * wait for the last remaining data to be sent.  Then, we unlink its
  4865. +  * async structure from the interrupt chain if necessary, and we free
  4866. +  * that IRQ if nothing is left in the chain.
  4867. +  * ------------------------------------------------------------
  4868. +  */
  4869. + static void rs_close( struct tty_struct *tty, struct file * filp )
  4870. + {
  4871. +     struct async_struct * info;
  4872. +     int line;
  4873. +     if (tty_hung_up_p(filp)) return;
  4874. +     
  4875. +     line = DEV_TO_SL(tty->line);
  4876. +     if ((line < 0) || (line >= NR_PORTS)) return;
  4877. +     info = rs_table + line;
  4878. +     if (!info->base) return;
  4879. +     
  4880. + #ifdef SERIAL_DEBUG_OPEN
  4881. +     printk("rs_close ttys%d, count = %d\n", info->line, info->count);
  4882. + #endif
  4883. +     if ((tty->count == 1) && (info->count != 1)) {
  4884. +         /*
  4885. +          * Uh, oh.  tty->count is 1, which means that the tty
  4886. +          * structure will be freed.  Info->count should always
  4887. +          * be one in these conditions.  If it's greater than
  4888. +          * one, we've got real problems, since it means the
  4889. +          * serial port won't be shutdown.
  4890. +          */
  4891. +         printk("rs_close: bad serial port count; tty->count is 1, "
  4892. +                "info->count is %d\n", info->count);
  4893. +         info->count = 1;
  4894. +     }
  4895. +     if (--info->count < 0) {
  4896. +         printk("rs_close: bad serial port count for ttys%d: %d\n",
  4897. +                info->line, info->count);
  4898. +         info->count = 0;
  4899. +     }
  4900. +     if (info->count)
  4901. +         return;
  4902. +     info->flags |= ASYNC_CLOSING;
  4903. +     /*
  4904. +      * Save the termios structure, since this port may have
  4905. +      * separate termios for callout and dialin.
  4906. +      */
  4907. +     if (info->flags & ASYNC_NORMAL_ACTIVE)
  4908. +         info->normal_termios = *tty->termios;
  4909. +     if (info->flags & ASYNC_CALLOUT_ACTIVE)
  4910. +         info->callout_termios = *tty->termios;
  4911. +     tty->stopped = 0;        /* Force flush to succeed */
  4912. +     tty->hw_stopped = 0;
  4913. +     if (info->flags & ASYNC_INITIALIZED) {
  4914. +         rs_start(tty);
  4915. +         wait_until_sent(tty, 6000); /* 60 seconds timeout */
  4916. +     } else
  4917. +         flush_output(tty);
  4918. +     flush_input(tty);
  4919. +     shutdown(info, 1);
  4920. +     clear_bit(line, rs_event);
  4921. +     info->event = 0;
  4922. +     info->tty = 0;
  4923. +     if (info->blocked_open) {
  4924. +         if (info->close_delay) {
  4925. +             tty->count++; /* avoid race condition */
  4926. +             current->state = TASK_INTERRUPTIBLE;
  4927. +             current->timeout = jiffies + info->close_delay;
  4928. +             schedule();
  4929. +             tty->count--;
  4930. +         }
  4931. +         wake_up_interruptible(&info->open_wait);
  4932. +     }
  4933. +     info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|ASYNC_CLOSING);
  4934. +     wake_up_interruptible(&info->close_wait);
  4935. + }
  4936. + /*
  4937. +  * rs_hangup() --- called by tty_hangup() when a hangup is signaled.
  4938. +  */
  4939. + void rs_hangup( struct tty_struct *tty )
  4940. + {
  4941. +     struct async_struct * info;
  4942. +     int line;
  4943. +     line = DEV_TO_SL(tty->line);
  4944. +     if ((line < 0) || (line >= NR_PORTS)) return;
  4945. +     info = rs_table + line;
  4946. +     if (!info->base) return;
  4947. +     
  4948. +     shutdown(info, 1);
  4949. +     clear_bit(line, rs_event);
  4950. +     info->event = 0;
  4951. +     info->count = 0;
  4952. +     info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
  4953. +     info->tty = 0;
  4954. +     wake_up_interruptible(&info->open_wait);
  4955. + }
  4956. + /*
  4957. +  * ------------------------------------------------------------
  4958. +  * rs_open() and friends
  4959. +  * ------------------------------------------------------------
  4960. +  */
  4961. + static int block_til_ready( struct tty_struct *tty, struct file * filp,
  4962. +                             struct async_struct *info )
  4963. + {
  4964. +     struct wait_queue wait = { current, NULL };
  4965. +     int        retval;
  4966. +     int        do_clocal = C_CLOCAL(tty);
  4967. +     /*
  4968. +      * If the device is in the middle of being closed, then block
  4969. +      * until it's done, and then try again.
  4970. +      */
  4971. +     if (info->flags & ASYNC_CLOSING) {
  4972. +         interruptible_sleep_on(&info->close_wait);
  4973. + #ifdef SERIAL_DO_RESTART
  4974. +         if (info->flags & ASYNC_HUP_NOTIFY)
  4975. +             return -EAGAIN;
  4976. +         else
  4977. +             return -ERESTARTSYS;
  4978. + #else
  4979. +         return -EAGAIN;
  4980. + #endif
  4981. +     }
  4982. +     /*
  4983. +      * If this is a callout device, then just make sure the normal
  4984. +      * device isn't being used.
  4985. +      */
  4986. +     if (MAJOR(filp->f_rdev) == TTYAUX_MAJOR) {
  4987. +         if (info->flags & ASYNC_NORMAL_ACTIVE)
  4988. +             return -EBUSY;
  4989. +         if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  4990. +             (info->flags & ASYNC_SESSION_LOCKOUT) &&
  4991. +             (info->session != current->session))
  4992. +             return -EBUSY;
  4993. +         if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  4994. +             (info->flags & ASYNC_PGRP_LOCKOUT) &&
  4995. +             (info->pgrp != current->pgrp))
  4996. +             return -EBUSY;
  4997. +         info->flags |= ASYNC_CALLOUT_ACTIVE;
  4998. +         return 0;
  4999. +     }
  5000. +     
  5001. +     /*
  5002. +      * If non-blocking mode is set, then make the check up front
  5003. +      * and then exit.
  5004. +      */
  5005. +     if (filp->f_flags & O_NONBLOCK) {
  5006. +         if (info->flags & ASYNC_CALLOUT_ACTIVE)
  5007. +             return -EBUSY;
  5008. +         info->flags |= ASYNC_NORMAL_ACTIVE;
  5009. +         return 0;
  5010. +     }
  5011. +     /*
  5012. +      * Block waiting for the carrier detect and the line to become
  5013. +      * free (i.e., not in use by the callout).  While we are in
  5014. +      * this loop, info->count is dropped by one, so that
  5015. +      * rs_close() knows when to free things.  We restore it upon
  5016. +      * exit, either normal or abnormal.
  5017. +      */
  5018. +     retval = 0;
  5019. +     add_wait_queue(&info->open_wait, &wait);
  5020. + #ifdef SERIAL_DEBUG_OPEN
  5021. +     printk("block_til_ready before block: ttys%d, count = %d\n",
  5022. +            info->line, info->count);
  5023. + #endif
  5024. +     info->count--;
  5025. +     info->blocked_open++;
  5026. +     while (1) {
  5027. +         cli();
  5028. +         if (!(info->flags & ASYNC_CALLOUT_ACTIVE))
  5029. +             info->sw->set_modem_info( info, 1, 1 );
  5030. +         sti();
  5031. +         current->state = TASK_INTERRUPTIBLE;
  5032. +         if (tty_hung_up_p(filp) ||
  5033. +             !(info->flags & ASYNC_INITIALIZED)) {
  5034. + #ifdef SERIAL_DO_RESTART
  5035. +             if (info->flags & ASYNC_HUP_NOTIFY)
  5036. +                 retval = -EAGAIN;
  5037. +             else
  5038. +                 retval = -ERESTARTSYS;
  5039. + #else
  5040. +             retval = -EAGAIN;
  5041. + #endif
  5042. +             break;
  5043. +         }
  5044. +         if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
  5045. +             !(info->flags & ASYNC_CLOSING) &&
  5046. +             (do_clocal || (info->sw->get_modem_info( info ) & TIOCM_CAR)))
  5047. +             break;
  5048. +         if (current->signal & ~current->blocked) {
  5049. +             retval = -ERESTARTSYS;
  5050. +             break;
  5051. +         }
  5052. + #ifdef SERIAL_DEBUG_OPEN
  5053. +         printk("block_til_ready blocking: ttys%d, count = %d\n",
  5054. +                info->line, info->count);
  5055. + #endif
  5056. +         schedule();
  5057. +     }
  5058. +     current->state = TASK_RUNNING;
  5059. +     remove_wait_queue(&info->open_wait, &wait);
  5060. +     if (!tty_hung_up_p(filp))
  5061. +         info->count++;
  5062. +     info->blocked_open--;
  5063. + #ifdef SERIAL_DEBUG_OPEN
  5064. +     printk("block_til_ready after blocking: ttys%d, count = %d\n",
  5065. +            info->line, info->count);
  5066. + #endif
  5067. +     if (retval)
  5068. +         return retval;
  5069. +     info->flags |= ASYNC_NORMAL_ACTIVE;
  5070. +     return 0;
  5071. + }    
  5072. + /*
  5073. +  * This routine is called whenever a serial port is opened.
  5074. +  */
  5075. + int rs_open( struct tty_struct *tty, struct file * filp )
  5076. + {
  5077. +     struct async_struct    *info;
  5078. +     int                 retval, line;
  5079. +     line = DEV_TO_SL(tty->line);
  5080. +     if ((line < 0) || (line >= NR_PORTS))
  5081. +         return( -ENODEV );
  5082. +     info = rs_table + line;
  5083. +     if (!info->base)
  5084. +         return( -ENODEV );
  5085. + #ifdef SERIAL_DEBUG_OPEN
  5086. +     printk("rs_open ttyS%d, count = %d\n", info->line, info->count);
  5087. + #endif
  5088. +     info->count++;
  5089. +     info->tty = tty;
  5090. +     
  5091. +     tty->write       = rs_write;
  5092. +     tty->close       = rs_close;
  5093. +     tty->ioctl       = rs_ioctl;
  5094. +     tty->throttle    = rs_throttle;
  5095. +     tty->set_termios = rs_set_termios;
  5096. +     tty->stop        = rs_stop;
  5097. +     tty->start       = rs_start;
  5098. +     tty->hangup      = rs_hangup;
  5099. +     if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
  5100. +         if (MAJOR(filp->f_rdev) == TTY_MAJOR)
  5101. +             *tty->termios = info->normal_termios;
  5102. +         else 
  5103. +             *tty->termios = info->callout_termios;
  5104. +     }
  5105. +     /*
  5106. +      * Start up serial port
  5107. +      */
  5108. +     if ((retval = startup(info, 1))) return retval;
  5109. +     retval = block_til_ready(tty, filp, info);
  5110. +     if (retval) {
  5111. + #ifdef SERIAL_DEBUG_OPEN
  5112. +         printk( "rs_open returning after block_til_ready with %d\n", retval );
  5113. + #endif
  5114. +         return retval;
  5115. +     }
  5116. +     info->session = current->session;
  5117. +     info->pgrp = current->pgrp;
  5118. + #ifdef SERIAL_DEBUG_OPEN
  5119. +     printk("rs_open ttyS%d successfull...", info->line);
  5120. + #endif
  5121. +     return 0;
  5122. + }
  5123. + /*
  5124. +  * Boot-time initialization code: Init the serial ports present on
  5125. +  * this machine type.
  5126. +  *
  5127. +  * Current HW Port to minor/device name mapping:
  5128. +  *
  5129. +  * Atari
  5130. +  *   TT                    | Falcon                    || minor | name
  5131. +  *  -----------------------+---------------------------++-------+-------
  5132. +  *   SCC B (Modem2)        | SCC B (Modem)             || 64    | ttyS0
  5133. +  *   SCC A (Serial2/LAN)   | SCC A (LAN)               || 65    | ttyS1
  5134. +  *   ST-MFP port (Modem1)  | --                        || 66    | ttyS2
  5135. +  *   TT-MFP port (Serial1) | ST-MFP port (no TOS name) || 67    | ttyS3
  5136. +  *
  5137. +  * The background of this mapping is that I wanted to assign the same
  5138. +  * minors to ports with the same capabilities. Staring with the MFPs
  5139. +  * would leave a hole in the first position on the Falcon!
  5140. +  *
  5141. +  * Should Serial2/LAN on the TT be split into two devices, selecting thus
  5142. +  * the connector used? Serial2 would be unassigned on the Falcon, and
  5143. +  * if one is open, opening the other would block.
  5144. +  * 
  5145. +  * Amiga
  5146. +  *   Amiga built-in serial port                        || 64    | ttyS0
  5147. +  * 
  5148. +  */
  5149. + long rs_init( long kmem_start )
  5150. + {
  5151. +     int                    i;
  5152. +     struct async_struct    *info;
  5153. +     memset( &rs_event, 0, sizeof(rs_event) );
  5154. +     bh_base[SERIAL_BH].routine = do_softint;
  5155. +     /* Initialize the async_struct's */
  5156. +     for( i = 0, info = rs_table; i < NR_PORTS; i++, info++ ) {
  5157. +     info->line           = i;
  5158. +     info->base         = NULL;
  5159. +     info->tty            = 0;
  5160. +     info->type           = PORT_UNKNOWN;
  5161. +     info->custom_divisor = 0;
  5162. +     info->close_delay    = 50;
  5163. +     info->x_char         = 0;
  5164. +     info->event          = 0;
  5165. +     info->count          = 0;
  5166. +     info->blocked_open   = 0;
  5167. +     memset(&info->callout_termios, 0, sizeof(struct termios));
  5168. +     memset(&info->normal_termios, 0, sizeof(struct termios));
  5169. +     info->open_wait      = 0;
  5170. +     info->xmit_wait      = 0;
  5171. +     info->close_wait     = 0;
  5172. +     }
  5173. +     switch (boot_info.machtype) {
  5174. +       case MACH_ATARI:
  5175. + #ifdef CONFIG_ATARI
  5176. +     /* Now initialize the ports themselves */
  5177. +     switch( boot_info.bi_atari.model ) {
  5178. +       case ATARI_TT:
  5179. +         atari_init_SCC(
  5180. +                &rs_table[0],
  5181. +                SCC_NORM, /* type */
  5182. +                1, /* Channel B */
  5183. +                (void *)&tt_mfp.par_dt_reg, 3, 0    /* RI */
  5184. +                );
  5185. +         atari_init_SCC(
  5186. +                &rs_table[1],
  5187. +                SCC_DMA,    /* type */
  5188. +                0, /* Channel A */
  5189. +                0, 0, 0 /* no RI */
  5190. +                );
  5191. +         atari_init_MFPser(
  5192. +                   &rs_table[2],
  5193. +                   MFP_CTRL, /* type */
  5194. +                   0, /* ST-MFP */
  5195. +                   (void *)&mfp.par_dt_reg, 6, 0    /* RI */
  5196. +                   );
  5197. +         atari_init_MFPser(
  5198. +                   &rs_table[3],
  5199. +                   MFP_BARE, /* type */
  5200. +                   1, /* TT_MFP */
  5201. +                   0, 0, 0 /* no RI */
  5202. +                   );
  5203. +         break;
  5204. +         
  5205. +       case ATARI_FALCON:
  5206. +         atari_init_SCC(
  5207. +                &rs_table[0],
  5208. +                SCC_NORM, /* type */
  5209. +                1, /* Channel B */
  5210. +                (void *)&mfp.par_dt_reg, 6, 0 /* RI */
  5211. +                );
  5212. +         atari_init_SCC(
  5213. +                &rs_table[1],
  5214. +                SCC_NORM, /* type */
  5215. +                0, /* Channel A */
  5216. +                0, 0, 0 /* no RI */
  5217. +                );
  5218. +         atari_init_MFPser(
  5219. +                   &rs_table[3],
  5220. +                   MFP_BARE, /* type */
  5221. +                   0, /* ST-MFP */
  5222. +                   0, 0, 0 /* no RI */
  5223. +                   );
  5224. +         break;
  5225. +     } /* end switch on atari model */
  5226. + #endif /* CONFIG_ATARI */
  5227. +     break;
  5228. +       case MACH_AMIGA:
  5229. + #ifdef CONFIG_AMIGA
  5230. +     printk("ttyS0: Amiga built-in serial port\n");
  5231. +     amiga_serinit ( &rs_table[0] );
  5232. + #endif
  5233. +     break;
  5234. +     } /* end switch on machine type */
  5235. +     
  5236. +     return( kmem_start );
  5237. + }
  5238. diff -cr --new-file linux-0.9pl1/drivers/char/serial.h linux-0.9pl2/drivers/char/serial.h
  5239. *** linux-0.9pl1/drivers/char/serial.h    Wed Dec 31 19:00:00 1969
  5240. --- linux-0.9pl2/drivers/char/serial.h    Sun Aug  7 11:51:15 1994
  5241. ***************
  5242. *** 0 ****
  5243. --- 1,322 ----
  5244. + /*
  5245. +  * serial.h: Common definitions for the Linux/68k serial driver
  5246. +  *
  5247. +  * Copyright 1994 Roman Hodek
  5248. +  *   EMail: rnhodek@cip.informatik.uni-erlangen.de (Internet)
  5249. +  *      or: Roman_Hodek@n.maus.de (MausNet, NO mail > 16 KB!)
  5250. +  *
  5251. +  * This file is subject to the terms and conditions of the GNU General Public
  5252. +  * License.  See the file README.legal in the main directory of this archive
  5253. +  * for more details.
  5254. +  *
  5255. +  */
  5256. + #ifndef _SERIAL_H
  5257. + #define _SERIAL_H
  5258. + #include <linux/tty.h>
  5259. + /* 4 is sufficient for now... */
  5260. + #define    NR_PORTS 4
  5261. + /* Structure describing one bit in a register that may be high- or
  5262. +  * low-active. This is used for RI detection, because the location of
  5263. +  * this signal varies widely. The function TEST_BITPOS() is provided
  5264. +  * to return the status of such a bit.
  5265. +  */
  5266. + typedef struct {
  5267. +     volatile unsigned char    *addr;            /* address of register */
  5268. +     unsigned char            bitno;            /* bit#, 0..7 */
  5269. +     unsigned char            active_state;    /* 1 for high-active,
  5270. +                                              * 0 for * low-active */
  5271. + } BITPOS;
  5272. + static __inline__ int TEST_BITPOS( BITPOS bp )
  5273. + {
  5274. +     return( !bp.addr ? 0 :
  5275. +             !!(*(bp.addr) & (1 << bp.bitno)) == bp.active_state );
  5276. + }
  5277. +     
  5278. + /* Atari serial port types are numbered from 100 to avoid interference
  5279. +  * with the PC types (1..4)
  5280. +  */
  5281. + typedef enum {
  5282. +     SCC_NORM = 100,    /* standard SCC channel */
  5283. +     SCC_DMA,        /* SCC channel with DMA support */
  5284. +     MFP_CTRL,        /* standard MFP port with modem control signals */
  5285. +     MFP_BARE,        /* MFP port without modem controls */
  5286. +     SER_AMIGA,        /* Amiga built-in serial port */
  5287. + } SERTYPE;
  5288. + /* This function tables does the abstraction from the underlying
  5289. +  * hardware:
  5290. +  *
  5291. +  *   init(): Initialize the port as necessary, set RTS and DTR and
  5292. +  *      enable interrupts. It does not need to set the speed and other
  5293. +  *      parameters, because change_speed() is called, too.
  5294. +  *   deinit(): Stop the port (wait for all characters to be sent,
  5295. +  *      disable interrupts)
  5296. +  *   enab_tx_int(): Enable or disable the Tx Buffer Empty interrupt
  5297. +  *      independantly from other interrupt sources. The pointer to
  5298. +  *      this function may be NULL, if there is no way to do this or it
  5299. +  *      is too complex. This Tx ints are just disabled to save some
  5300. +  *      interrupts if the transmitter is stopped anyway.
  5301. +  *   check_custom_divisor(): Check the given custom divisor for legality
  5302. +  *      and return 0 if OK, non-zero otherwise.
  5303. +  *   change_speed(): Set port speed, character size, number of stop
  5304. +  *      bits and parity from the termios structure. If the user wants
  5305. +  *      to set the speed with a custom divisor, he is required to
  5306. +  *      check the baud_base first!
  5307. +  *   restart(): Is called every time new data arrived in the Tx queue
  5308. +  *      and may be used to restart the transmitter if it ran empty.
  5309. +  *      This function is called with interrupts off.
  5310. +  *   throttle(): Set or clear the RTS line according to 'status'.
  5311. +  *   set_break(): Set or clear the 'Send a Break' flag.
  5312. +  *   get_serial_info(): Fill in the baud_base and custom_divisor
  5313. +  *      fields of a serial_struct. It may also modify other fields, if
  5314. +  *      needed.
  5315. +  *   get_modem_info(): Return the status of RTS, DTR, DCD, RI, DSR and CTS.
  5316. +  *   set_modem_info(): Set the status of RTS and DTR according to
  5317. +  *      'new_dtr' and 'new_rts', resp. 0 = clear, 1 = set, -1 = don't change
  5318. +  *   ioctl(): Process any port-specific ioctl's. This pointer may be
  5319. +  *      NULL, if the port has no own ioctl's.
  5320. +  *
  5321. +  */
  5322. + struct async_struct;
  5323. + typedef struct {
  5324. +     void (*init)( struct async_struct *info );
  5325. +     void (*deinit)( struct async_struct *info, int leave_dtr );
  5326. +     void (*enab_tx_int)( struct async_struct *info, int enab_flag );
  5327. +     int  (*check_custom_divisor)( struct async_struct *info, int divisor );
  5328. +     void (*change_speed)( struct async_struct *info );
  5329. +     void (*restart)( struct async_struct *info );
  5330. +     void (*throttle)( struct async_struct *info, int status );
  5331. +     void (*set_break)( struct async_struct *info, int break_flag );
  5332. +     void (*get_serial_info)( struct async_struct *info,
  5333. +                 struct serial_struct *retinfo );
  5334. +     unsigned int (*get_modem_info)( struct async_struct *info );
  5335. +     int  (*set_modem_info)( struct async_struct *info, int new_dtr,
  5336. +                    int new_rts );
  5337. +     int  (*ioctl)( struct tty_struct *tty, struct file *file,
  5338. +               struct async_struct *info, unsigned int cmd,
  5339. +               unsigned long arg );
  5340. + } SERIALSWITCH;
  5341. + /* This is a modified version of the PC-Linux async_struct. Mainly,
  5342. +  * stuff like port address, xmit_fifo_size and the like are left out
  5343. +  * and other information fields were added.
  5344. +  */
  5345. + struct async_struct {
  5346. +     /* Atari specific fields */
  5347. +     SERTYPE            type;         /* UART type */
  5348. +     volatile void        *base;        /* base address */
  5349. +     BITPOS            RI;            /* Where the Ring Indicator is signalled */
  5350. +     SERIALSWITCH        *sw;        /* functions to manage this port */
  5351. +     /* common fields */
  5352. +     int            flags;
  5353. +     struct tty_struct     *tty;
  5354. +     int            timeout;
  5355. +     int            custom_divisor;
  5356. +     int            x_char;        /* xon/xoff characater */
  5357. +     int            close_delay;
  5358. +     int            event;
  5359. +     int            line;
  5360. +     int            count;        /* # of fd on device */
  5361. +     int            blocked_open; /* # of blocked opens */
  5362. +     long            session;    /* Session of opening process */
  5363. +     long            pgrp;        /* pgrp of opening process */
  5364. +     struct termios        normal_termios;
  5365. +     struct termios        callout_termios;
  5366. +     struct wait_queue    *open_wait;
  5367. +     struct wait_queue    *close_wait;
  5368. +     struct wait_queue    *xmit_wait;
  5369. + };
  5370. + /*
  5371. +  * Events are used to schedule things to happen at timer-interrupt
  5372. +  * time, instead of at rs interrupt time.
  5373. +  */
  5374. + #define RS_EVENT_READ_PROCESS    0
  5375. + #define RS_EVENT_WRITE_WAKEUP    1
  5376. + #define RS_EVENT_HANGUP        2
  5377. + #define RS_EVENT_BREAK        3
  5378. + #define RS_EVENT_OPEN_WAKEUP    4
  5379. + /***************************** Prototypes *****************************/
  5380. + void rs_stop( struct tty_struct *tty );
  5381. + void rs_start( struct tty_struct *tty );
  5382. + void rs_write( struct tty_struct * tty );
  5383. + void rs_throttle( struct tty_struct * tty, int status );
  5384. + void rs_hangup( struct tty_struct *tty );
  5385. + int rs_open( struct tty_struct *tty, struct file * filp );
  5386. + long rs_init( long kmem_start );
  5387. + /************************* End of Prototypes **************************/
  5388. + /*************************** Inline Functions *************************/
  5389. + #include <linux/interrupt.h>
  5390. + #include <asm/bitops.h>
  5391. + /*
  5392. +  * This routine is used by the interrupt handler to schedule
  5393. +  * processing in the software interrupt portion of the driver.
  5394. +  * It is needed in the port-specific interrupt handlers, so it is
  5395. +  * declared here in the common header.
  5396. +  */
  5397. + extern char rs_event[];
  5398. + static inline void rs_sched_event( struct async_struct *info, int event )
  5399. + {
  5400. +     set_bit(event, &info->event);
  5401. +     set_bit(info->line, rs_event);
  5402. +     mark_bh(SERIAL_BH);
  5403. + }
  5404. + /* The following functions do common tasks needed in the interrupt
  5405. +  * service routine(s):
  5406. +  * 
  5407. +  *  - Putting a character into the read_queue, either with or without
  5408. +  *    an error condition, and waking up processes waiting for
  5409. +  *    something to arrive
  5410. +  *  - Check if a throttle is needed due to the read queue getting full
  5411. +  *  - Removing a character from the write queue, obeying pending flow
  5412. +  *    control characters
  5413. +  *  - Checking for enough characters in the write queue to wake up
  5414. +  *    sleeping processes
  5415. +  *  - Doing required actions on wait queues if DCD has changed
  5416. +  *  - Doing required actions on wait queues if CTS has changed;
  5417. +  *    returns non-zero, if the transmitter should be restarted
  5418. +  */
  5419. + static __inline__ void rs_put_char_to_queue( struct async_struct *info,
  5420. +                         int c, int err )
  5421. + {    struct tty_queue    *q = &info->tty->read_q;
  5422. +     
  5423. +     if (!FULL(q)) {
  5424. +         if (err) {
  5425. +             if (err == TTY_BREAK)
  5426. +                 rs_sched_event( info, RS_EVENT_BREAK );
  5427. +             /* ignore parity errors if parity checking isn't enabled. */
  5428. +             if (!(err == TTY_PARITY && !I_INPCK(info->tty))) {
  5429. +                 set_bit( q->head, &info->tty->readq_flags );
  5430. +                 c = err;
  5431. +             }
  5432. +         }
  5433. +         q->buf[q->head] = c;
  5434. +         INC(q->head);
  5435. +         rs_sched_event( info, RS_EVENT_READ_PROCESS );
  5436. +     }
  5437. + }
  5438. + static __inline__ void rs_rx_throttle_if_needed( struct async_struct *info )
  5439. + {    struct tty_queue    *q = &info->tty->read_q;
  5440. +     if (LEFT(q) < RQ_THRESHOLD_LW &&
  5441. +         !set_bit( TTY_RQ_THROTTLED, &info->tty->flags))
  5442. +         rs_throttle( info->tty, TTY_THROTTLE_RQ_FULL );
  5443. + }
  5444. + static __inline__ int rs_get_char_from_queue( struct async_struct *info )
  5445. + {    int                    ch;
  5446. +     struct tty_queue    *q = &info->tty->write_q;
  5447. +     if (info->x_char) {
  5448. +         ch = info->x_char;
  5449. +         info->x_char = 0;
  5450. +     }
  5451. +     else if (!EMPTY(q)) {
  5452. +         ch = q->buf[q->tail];
  5453. +         INC(q->tail);
  5454. +     }
  5455. +     else {
  5456. +         rs_stop( info->tty );
  5457. +         ch = -1;
  5458. +     }
  5459. +     return( ch );
  5460. + }
  5461. + static __inline__ void rs_tx_wakeup_if_needed( struct async_struct *info )
  5462. + {    struct tty_queue    *q = &info->tty->write_q;
  5463. +     if (LEFT(q) > WAKEUP_CHARS) {
  5464. +         rs_sched_event( info, RS_EVENT_WRITE_WAKEUP );
  5465. +         if (info->tty->write_data_cnt) {
  5466. +             set_bit( info->tty->line, &tty_check_write );
  5467. +             mark_bh( TTY_BH );
  5468. +         }
  5469. +     }
  5470. + }
  5471. + static __inline__ void rs_dcd_changed( struct async_struct *info, int dcd )
  5472. + {
  5473. +     if (!C_CLOCAL(info->tty)) {
  5474. +         if (dcd)
  5475. +             rs_sched_event( info, RS_EVENT_OPEN_WAKEUP );
  5476. +         else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
  5477. +                    (info->flags & ASYNC_CALLOUT_NOHUP)))
  5478. +             rs_sched_event( info, RS_EVENT_HANGUP );
  5479. +     }
  5480. + }
  5481. + static __inline__ int rs_cts_changed( struct async_struct *info, int cts )
  5482. + {
  5483. +     if (!C_CRTSCTS(info->tty) || (info->flags & ASYNC_CLOSING))
  5484. +         return( 0 );
  5485. +     if (info->tty->hw_stopped) {
  5486. +         if (cts) {
  5487. +             info->tty->hw_stopped = 0;
  5488. +             rs_start( info->tty );
  5489. +             return( 1 );
  5490. +         }
  5491. +     }
  5492. +     else {
  5493. +         if (!cts) {
  5494. +             info->tty->hw_stopped = 1;
  5495. +             rs_stop( info->tty );
  5496. +         }
  5497. +     }
  5498. +     return( 0 );
  5499. + }
  5500. + #endif /* _SERIAL_H */
  5501. diff -cr --new-file linux-0.9pl1/drivers/scsi/atari_NCR5380.c linux-0.9pl2/drivers/scsi/atari_NCR5380.c
  5502. *** linux-0.9pl1/drivers/scsi/atari_NCR5380.c    Sun Jun 26 19:24:04 1994
  5503. --- linux-0.9pl2/drivers/scsi/atari_NCR5380.c    Fri Aug  5 12:47:09 1994
  5504. ***************
  5505. *** 459,464 ****
  5506. --- 459,465 ----
  5507.       printk("\n");
  5508.   }
  5509.   
  5510. + #if NDEBUG & (NDEBUG_PIO | NDEBUG_INFORMATION)
  5511.   static struct {
  5512.       unsigned char value;
  5513.       char *name;
  5514. ***************
  5515. *** 494,499 ****
  5516. --- 495,501 ----
  5517.       }
  5518.   }
  5519.   #endif
  5520. + #endif
  5521.   
  5522.   /*
  5523.    * We need to have our corroutine active given these constraints : 
  5524. ***************
  5525. *** 642,648 ****
  5526.       *prev = instance;
  5527.       timer_table[NCR5380_TIMER].expires = expires_first->time_expires;
  5528.       timer_active |= 1 << NCR5380_TIMER;
  5529. !     sti;
  5530.       return 0;
  5531.   }    
  5532.   
  5533. --- 644,650 ----
  5534.       *prev = instance;
  5535.       timer_table[NCR5380_TIMER].expires = expires_first->time_expires;
  5536.       timer_active |= 1 << NCR5380_TIMER;
  5537. !     sti ();
  5538.       return 0;
  5539.   }    
  5540.   
  5541. ***************
  5542. *** 840,846 ****
  5543.           hostdata->id_higher_mask |= i;
  5544.       for (i = 0; i < 8; ++i)
  5545.       hostdata->busy[i] = 0;
  5546. ! #ifdef REAL_DMA
  5547.       hostdata->dma_len = 0;
  5548.   #endif
  5549.       hostdata->connected = NULL;
  5550. --- 842,848 ----
  5551.           hostdata->id_higher_mask |= i;
  5552.       for (i = 0; i < 8; ++i)
  5553.       hostdata->busy[i] = 0;
  5554. ! #if defined (REAL_DMA) || defined (REAL_DMA_POLL)
  5555.       hostdata->dma_len = 0;
  5556.   #endif
  5557.       hostdata->connected = NULL;
  5558. ***************
  5559. *** 1166,1174 ****
  5560.        * set in the BASR.
  5561.        */
  5562.       if (IS_A_TT())
  5563. !         tt_mfp.int_pn_a &= ~0x80;
  5564.       else
  5565. !         mfp.int_pn_b &= ~0x80;
  5566.       }
  5567.   #endif /* !READ_OVERRUNS */
  5568.   
  5569. --- 1168,1176 ----
  5570.        * set in the BASR.
  5571.        */
  5572.       if (IS_A_TT())
  5573. !         tt_mfp.int_pn_a = (unsigned char) ~0x80;
  5574.       else
  5575. !         mfp.int_pn_b = (unsigned char) ~0x80;
  5576.       }
  5577.   #endif /* !READ_OVERRUNS */
  5578.   
  5579. ***************
  5580. *** 2262,2268 ****
  5581.                   sti();
  5582.   #if (NDEBUG & NDEBUG_QUEUES)
  5583.               printk("scsi%d : REQUEST SENSE added to head of issue queue\n",
  5584. !                    instance->host_no);
  5585.   #endif
  5586.              } else
  5587.   #endif /* def AUTOSENSE */
  5588. --- 2264,2270 ----
  5589.                   sti();
  5590.   #if (NDEBUG & NDEBUG_QUEUES)
  5591.               printk("scsi%d : REQUEST SENSE added to head of issue queue\n",
  5592. !                    cmd->host->host_no);
  5593.   #endif
  5594.              } else
  5595.   #endif /* def AUTOSENSE */
  5596. diff -cr --new-file linux-0.9pl1/drivers/scsi/atari_sc.c linux-0.9pl2/drivers/scsi/atari_sc.c
  5597. *** linux-0.9pl1/drivers/scsi/atari_sc.c    Sun Jun 26 19:24:06 1994
  5598. --- linux-0.9pl2/drivers/scsi/atari_sc.c    Fri Aug  5 13:48:19 1994
  5599. ***************
  5600. *** 81,86 ****
  5601. --- 81,87 ----
  5602.   #define    READ_OVERRUNS
  5603.   #endif
  5604.   
  5605. + #include <linux/types.h>
  5606.   #include <linux/stddef.h>
  5607.   #include <linux/interrupt.h>
  5608.   #include <linux/bootinfo.h>
  5609. ***************
  5610. *** 760,771 ****
  5611.   #include "atari_NCR5380.c"
  5612.   
  5613.   #endif /* CONFIG_ATARI_*_SCSI */
  5614. --- 761,763 ----
  5615. diff -cr --new-file linux-0.9pl1/drivers/scsi/gvp11.c linux-0.9pl2/drivers/scsi/gvp11.c
  5616. *** linux-0.9pl1/drivers/scsi/gvp11.c    Tue Jun  7 19:39:26 1994
  5617. --- linux-0.9pl2/drivers/scsi/gvp11.c    Sun Aug 14 10:09:57 1994
  5618. ***************
  5619. *** 37,50 ****
  5620.       }
  5621.   }
  5622.   
  5623.   static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
  5624.   {
  5625.       unsigned short cntr = GVP11_DMAC_INT_ENABLE;
  5626.       unsigned long addr = VTOP(cmd->SCp.ptr);
  5627.   
  5628.       /* don't allow DMA if the physical address is bad */
  5629. !     if (addr & GVP11_XFER_MASK)
  5630. !     return 1;
  5631.   
  5632.       /* setup dma direction */
  5633.       if (!dir_in)
  5634. --- 37,98 ----
  5635.       }
  5636.   }
  5637.   
  5638. + /*
  5639. +  * DMA transfer mask for GVP Series II SCSI controller.
  5640. +  * Some versions can only DMA into the 24 bit address space
  5641. +  * (0->16M).  Others can DMA into the full 32 bit address
  5642. +  * space.  The default is to only allow DMA into the 24 bit
  5643. +  * address space.  The "gvp11=0xFFFFFFFE" setup parameter can
  5644. +  * be supplied to force an alternate (32 bit) mask.
  5645. +  */
  5646. + static int gvp11_xfer_mask = GVP11_XFER_MASK;
  5647. + void gvp11_setup (char *str, int *ints)
  5648. + {
  5649. +     gvp11_xfer_mask = ints[1];
  5650. + }
  5651.   static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
  5652.   {
  5653.       unsigned short cntr = GVP11_DMAC_INT_ENABLE;
  5654.       unsigned long addr = VTOP(cmd->SCp.ptr);
  5655.   
  5656.       /* don't allow DMA if the physical address is bad */
  5657. !     if (addr & gvp11_xfer_mask ||
  5658. !     (!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual)))
  5659. !     {
  5660. !     HDATA(cmd->host)->dma_bounce_len = (cmd->SCp.this_residual + 511)
  5661. !         & ~0x1ff;
  5662. !     HDATA(cmd->host)->dma_bounce_buffer =
  5663. !         scsi_malloc (HDATA(cmd->host)->dma_bounce_len);
  5664. !     
  5665. !     /* can't allocate memory; use PIO */
  5666. !     if (!HDATA(cmd->host)->dma_bounce_buffer) {
  5667. !         HDATA(cmd->host)->dma_bounce_len = 0;
  5668. !         return 1;
  5669. !     }
  5670. !     /* check if the address of the bounce buffer is OK */
  5671. !     addr = VTOP(HDATA(cmd->host)->dma_bounce_buffer);
  5672. !     if (addr & gvp11_xfer_mask) {
  5673. !         scsi_free (HDATA(cmd->host)->dma_bounce_buffer,
  5674. !                HDATA(cmd->host)->dma_bounce_len);
  5675. !         HDATA(cmd->host)->dma_bounce_buffer = NULL;
  5676. !         HDATA(cmd->host)->dma_bounce_len = 0;
  5677. !         return 1;
  5678. !     }
  5679. !         
  5680. !     if (!dir_in) {
  5681. !         /* copy to bounce buffer for a write */
  5682. !         if (cmd->use_sg)
  5683. !         panic ("scsi%ddma: incomplete s/g support",
  5684. !                cmd->host->host_no);
  5685. !         else
  5686. !         memcpy (HDATA(cmd->host)->dma_bounce_buffer,
  5687. !             cmd->request_buffer, cmd->request_bufflen);
  5688. !     }
  5689. !     }
  5690.   
  5691.       /* setup dma direction */
  5692.       if (!dir_in)
  5693. ***************
  5694. *** 74,82 ****
  5695.                 int status)
  5696.   {
  5697.       /* stop DMA */
  5698. !     DMA(SCpnt->host)->SP_DMA = 1;
  5699.       /* remove write bit from CONTROL bits */
  5700. !     DMA(SCpnt->host)->CNTR = GVP11_DMAC_INT_ENABLE;
  5701.   }
  5702.   
  5703.   int gvp11_detect(int host_nr)
  5704. --- 122,148 ----
  5705.                 int status)
  5706.   {
  5707.       /* stop DMA */
  5708. !     DMA(instance)->SP_DMA = 1;
  5709.       /* remove write bit from CONTROL bits */
  5710. !     DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE;
  5711. !     /* copy from a bounce buffer, if necessary */
  5712. !     if (status && HDATA(instance)->dma_bounce_buffer) {
  5713. !     if (SCpnt && SCpnt->use_sg) {
  5714. !         panic ("scsi%d: incomplete s/g support",
  5715. !            instance->host_no);
  5716. !     } else {
  5717. !         if (HDATA(instance)->dma_dir && SCpnt)
  5718. !         memcpy (SCpnt->request_buffer,
  5719. !             HDATA(instance)->dma_bounce_buffer,
  5720. !             SCpnt->request_bufflen);
  5721. !         scsi_free (HDATA(instance)->dma_bounce_buffer,
  5722. !                HDATA(instance)->dma_bounce_len);
  5723. !         HDATA(instance)->dma_bounce_buffer = NULL;
  5724. !         HDATA(instance)->dma_bounce_len = 0;
  5725. !     }
  5726. !     }
  5727.   }
  5728.   
  5729.   int gvp11_detect(int host_nr)
  5730. diff -cr --new-file linux-0.9pl1/drivers/scsi/scsi.c linux-0.9pl2/drivers/scsi/scsi.c
  5731. *** linux-0.9pl1/drivers/scsi/scsi.c    Thu Jul  7 07:21:59 1994
  5732. --- linux-0.9pl2/drivers/scsi/scsi.c    Sun Aug 14 09:51:44 1994
  5733. ***************
  5734. *** 142,147 ****
  5735. --- 142,149 ----
  5736.      {"RODIME","RO3000S","2.33"},  /* Locks up if polled for lun != 0 */
  5737.      {"SEAGATE", "ST157N", "\004|j"}, /* causes failed REQUEST SENSE on lun 1 for aha152x
  5738.                        * controller, which causes SCSI code to reset bus.*/
  5739. +    {"SEAGATE", "ST138N", "\004|j"}, /* causes failed REQUEST SENSE on lun 1 for aha152x
  5740. +                      * controller, which causes SCSI code to reset bus.*/
  5741.      {"SEAGATE", "ST296","921"},   /* Responds to all lun */
  5742.      {"SONY","CD-ROM CDU-541","4.3d"},
  5743.      {"TANDBERG","TDC 3600","U07"},  /* Locks up if polled for lun != 0 */
  5744. diff -cr --new-file linux-0.9pl1/fs/minix/bitmap.c linux-0.9pl2/fs/minix/bitmap.c
  5745. *** linux-0.9pl1/fs/minix/bitmap.c    Tue Jun  7 19:39:00 1994
  5746. --- linux-0.9pl2/fs/minix/bitmap.c    Fri Aug  5 12:46:38 1994
  5747. ***************
  5748. *** 117,127 ****
  5749.       }
  5750.   repeat:
  5751.       j = 8192;
  5752. !     for (i=0 ; i<8 ; i++)
  5753.           if ((bh=sb->u.minix_sb.s_zmap[i]) != NULL)
  5754.               if ((j=find_first_zero(bh->b_data))<8192)
  5755.                   break;
  5756. !     if (i>=8 || !bh || j>=8192)
  5757.           return 0;
  5758.       if (set_bit(BIT(j),bh->b_data)) {
  5759.           printk("new_block: bit already set (%d)\n", j);
  5760. --- 117,127 ----
  5761.       }
  5762.   repeat:
  5763.       j = 8192;
  5764. !     for (i=0 ; i<64 ; i++)
  5765.           if ((bh=sb->u.minix_sb.s_zmap[i]) != NULL)
  5766.               if ((j=find_first_zero(bh->b_data))<8192)
  5767.                   break;
  5768. !     if (i>=64 || !bh || j>=8192)
  5769.           return 0;
  5770.       if (set_bit(BIT(j),bh->b_data)) {
  5771.           printk("new_block: bit already set (%d)\n", j);
  5772. diff -cr --new-file linux-0.9pl1/fs/minix/fsync.c linux-0.9pl2/fs/minix/fsync.c
  5773. *** linux-0.9pl1/fs/minix/fsync.c    Tue Jun  7 19:38:59 1994
  5774. --- linux-0.9pl2/fs/minix/fsync.c    Fri Aug  5 12:46:39 1994
  5775. ***************
  5776. *** 5,10 ****
  5777. --- 5,12 ----
  5778.    *  from
  5779.    *  Copyright (C) 1991, 1992 Linus Torvalds
  5780.    *
  5781. +  *  Extended for v2 filesystem by Andreas Schwab 1994
  5782. +  *
  5783.    *  minix fsync primitive
  5784.    */
  5785.   
  5786. ***************
  5787. *** 23,28 ****
  5788. --- 25,31 ----
  5789.   
  5790.   #define blocksize BLOCK_SIZE
  5791.   #define addr_per_block 512
  5792. + #define addr_per_block2 256
  5793.   
  5794.   static int sync_block (struct inode * inode, unsigned short * block, int wait)
  5795.   {
  5796. ***************
  5797. *** 53,58 ****
  5798. --- 56,93 ----
  5799.       return 0;
  5800.   }
  5801.   
  5802. + static int
  5803. + sync_block2 (struct inode *inode, unsigned long *block, int wait)
  5804. + {
  5805. +   struct buffer_head *bh;
  5806. +   unsigned short tmp;
  5807. +   if (!*block)
  5808. +     return 0;
  5809. +   tmp = *block;
  5810. +   bh = get_hash_table (inode->i_dev, *block, blocksize);
  5811. +   if (!bh)
  5812. +     return 0;
  5813. +   if (*block != tmp)
  5814. +     {
  5815. +       brelse (bh);
  5816. +       return 1;
  5817. +     }
  5818. +   if (wait &&bh->b_req && !bh->b_uptodate)
  5819. +     {
  5820. +       brelse (bh);
  5821. +       return -1;
  5822. +     }
  5823. +   if (wait || !bh->b_uptodate || !bh->b_dirt)
  5824. +     {
  5825. +       brelse (bh);
  5826. +       return 0;
  5827. +     }
  5828. +   ll_rw_block (WRITE, 1, &bh);
  5829. +   bh->b_count--;
  5830. +   return 0;
  5831. + }
  5832.   static int sync_iblock (struct inode * inode, unsigned short * iblock, 
  5833.               struct buffer_head **bh, int wait) 
  5834.   {
  5835. ***************
  5836. *** 77,82 ****
  5837. --- 112,143 ----
  5838.       return 0;
  5839.   }
  5840.   
  5841. + static int
  5842. + sync_iblock2 (struct inode *inode, unsigned long *iblock,
  5843. +           struct buffer_head **bh, int wait)
  5844. + {
  5845. +   int rc;
  5846. +   unsigned short tmp;
  5847. +   *bh = NULL;
  5848. +   tmp = *iblock;
  5849. +   if (!tmp)
  5850. +     return 0;
  5851. +   rc = sync_block2 (inode, iblock, wait);
  5852. +   if (rc)
  5853. +     return rc;
  5854. +   *bh = bread (inode->i_dev, tmp, blocksize);
  5855. +   if (tmp != *iblock)
  5856. +     {
  5857. +       brelse (*bh);
  5858. +       *bh = NULL;
  5859. +       return 1;
  5860. +     }
  5861. +   if (!*bh)
  5862. +     return -1;
  5863. +   return 0;
  5864. + }
  5865.   
  5866.   static int sync_direct(struct inode *inode, int wait)
  5867.   {
  5868. ***************
  5869. *** 93,98 ****
  5870. --- 154,176 ----
  5871.       return err;
  5872.   }
  5873.   
  5874. + static int
  5875. + sync_direct2 (struct inode *inode, int wait)
  5876. + {
  5877. +   int i;
  5878. +   int rc, err = 0;
  5879. +   for (i = 0; i < 7; i++)
  5880. +     {
  5881. +       rc = sync_block2 (inode, inode->u.minix_i.i_data2 + i, wait);
  5882. +       if (rc > 0)
  5883. +     break;
  5884. +       if (rc)
  5885. +     err = rc;
  5886. +     }
  5887. +   return err;
  5888. + }
  5889.   static int sync_indirect(struct inode *inode, unsigned short *iblock, int wait)
  5890.   {
  5891.       int i;
  5892. ***************
  5893. *** 116,121 ****
  5894. --- 194,222 ----
  5895.       return err;
  5896.   }
  5897.   
  5898. + static int
  5899. + sync_indirect2 (struct inode *inode, unsigned long *iblock, int wait)
  5900. + {
  5901. +   int i;
  5902. +   struct buffer_head *ind_bh;
  5903. +   int rc, err = 0;
  5904. +   rc = sync_iblock2 (inode, iblock, &ind_bh, wait);
  5905. +   if (rc || !ind_bh)
  5906. +     return rc;
  5907. +   for (i = 0; i < addr_per_block2; i++)
  5908. +     {
  5909. +       rc = sync_block2 (inode, ((unsigned long *) ind_bh->b_data) + i, wait);
  5910. +       if (rc > 0)
  5911. +     break;
  5912. +       if (rc)
  5913. +     err = rc;
  5914. +     }
  5915. +   brelse (ind_bh);
  5916. +   return err;
  5917. + }
  5918.   static int sync_dindirect(struct inode *inode, unsigned short *diblock,
  5919.                 int wait)
  5920.   {
  5921. ***************
  5922. *** 140,145 ****
  5923. --- 241,270 ----
  5924.       return err;
  5925.   }
  5926.   
  5927. + static int 
  5928. + sync_dindirect2 (struct inode *inode, unsigned long *diblock, int wait)
  5929. + {
  5930. +   int i;
  5931. +   struct buffer_head *dind_bh;
  5932. +   int rc, err = 0;
  5933. +   rc = sync_iblock2 (inode, diblock, &dind_bh, wait);
  5934. +   if (rc || !dind_bh)
  5935. +     return rc;
  5936. +   for (i = 0; i < addr_per_block2; i++)
  5937. +     {
  5938. +       rc = sync_indirect2 (inode, ((unsigned long *) dind_bh->b_data) + i,
  5939. +                wait);
  5940. +       if (rc > 0)
  5941. +     break;
  5942. +       if (rc)
  5943. +     err = rc;
  5944. +     }
  5945. +   brelse (dind_bh);
  5946. +   return err;
  5947. + }
  5948.   int minix_sync_file(struct inode * inode, struct file * file)
  5949.   {
  5950.       int wait, err = 0;
  5951. ***************
  5952. *** 150,158 ****
  5953. --- 275,293 ----
  5954.   
  5955.       for (wait=0; wait<=1; wait++)
  5956.       {
  5957. +       if (inode->i_sb->u.minix_sb.s_version)
  5958. +         {
  5959. +           err |= sync_direct2 (inode, wait);
  5960. +           err |= sync_indirect2 (inode, inode->u.minix_i.i_data2+7, wait);
  5961. +           err |= sync_dindirect2 (inode, inode->u.minix_i.i_data2+8, wait);
  5962. +           err |= sync_dindirect2 (inode, inode->u.minix_i.i_data2+9, wait);
  5963. +         }
  5964. +       else
  5965. +         {
  5966.           err |= sync_direct(inode, wait);
  5967.           err |= sync_indirect(inode, inode->u.minix_i.i_data+7, wait);
  5968.           err |= sync_dindirect(inode, inode->u.minix_i.i_data+8, wait);
  5969. +         }
  5970.       }
  5971.       err |= minix_sync_inode (inode);
  5972.       return (err < 0) ? -EIO : 0;
  5973. diff -cr --new-file linux-0.9pl1/fs/minix/inode.c linux-0.9pl2/fs/minix/inode.c
  5974. *** linux-0.9pl1/fs/minix/inode.c    Tue Jun  7 19:39:00 1994
  5975. --- linux-0.9pl2/fs/minix/inode.c    Fri Aug  5 12:46:42 1994
  5976. ***************
  5977. *** 3,8 ****
  5978. --- 3,10 ----
  5979.    *
  5980.    *  Copyright (C) 1991, 1992  Linus Torvalds
  5981.    *
  5982. +  *  Extended for v2 filesystem by Andreas Schwab 1994
  5983. +  *
  5984.    * This file is subject to the terms and conditions of the GNU General Public
  5985.    * License.  See the file README.legal in the main directory of this archive
  5986.    * for more details.
  5987. ***************
  5988. *** 81,86 ****
  5989. --- 83,100 ----
  5990.       minix_remount
  5991.   };
  5992.   
  5993. + static struct super_operations minix_sops_v2 =
  5994. + {
  5995. +   minix_read_inode2,
  5996. +   NULL,
  5997. +   minix_write_inode,
  5998. +   minix_put_inode,
  5999. +   minix_put_super,
  6000. +   minix_write_super,
  6001. +   minix_statfs,
  6002. +   minix_remount
  6003. + };
  6004.   int minix_remount (struct super_block * sb, int * flags, char * data)
  6005.   {
  6006.       struct minix_super_block * ms;
  6007. ***************
  6008. *** 122,127 ****
  6009. --- 136,171 ----
  6010.   #define BIT(bit) (bit)
  6011.   #endif
  6012.   
  6013. + static int
  6014. + get_dirsize (struct super_block *s)
  6015. + {
  6016. +   struct buffer_head *bh;
  6017. +   struct inode *dir;
  6018. +   struct minix_dir_entry *entry;
  6019. +   int dirsize;
  6020. +   dir = s->s_mounted;
  6021. +   bh = minix_bread (dir, 0, 0);
  6022. +   if (!bh)
  6023. +     {
  6024. +       printk ("MINIX-fs: unable to read root directory\n");
  6025. +       return 0;
  6026. +     }
  6027. +   for (dirsize = 16; dirsize < BLOCK_SIZE; dirsize <<= 1)
  6028. +     {
  6029. +       entry = (struct minix_dir_entry *) (bh->b_data + dirsize);
  6030. +       if (strcmp (entry->name, "..") == 0)
  6031. +     {
  6032. +       s->u.minix_sb.s_dirsize = dirsize;
  6033. +       s->u.minix_sb.s_namelen = dirsize - 2;
  6034. +       brelse (bh);
  6035. +       return 1;
  6036. +     }
  6037. +     }
  6038. +   printk ("MINIX-fs: unable to get directory size\n");
  6039. +   return 0;
  6040. + }
  6041.   struct super_block *minix_read_super(struct super_block *s,void *data,
  6042.                        int silent)
  6043.   {
  6044. ***************
  6045. *** 132,137 ****
  6046. --- 176,183 ----
  6047.   
  6048.       if (32 != sizeof (struct minix_inode))
  6049.           panic("bad i-node size");
  6050. +     if (64 != sizeof (struct new_minix_inode))
  6051. +         panic("bad v2 i-node size");
  6052.       lock_super(s);
  6053.       if (!(bh = bread(dev,1,BLOCK_SIZE))) {
  6054.           s->s_dev=0;
  6055. ***************
  6056. *** 156,165 ****
  6057.       if (s->s_magic == MINIX_SUPER_MAGIC) {
  6058.           s->u.minix_sb.s_dirsize = 16;
  6059.           s->u.minix_sb.s_namelen = 14;
  6060.       } else if (s->s_magic == MINIX_SUPER_MAGIC2) {
  6061.           s->u.minix_sb.s_dirsize = 32;
  6062.           s->u.minix_sb.s_namelen = 30;
  6063. !     } else {
  6064.           s->s_dev = 0;
  6065.           unlock_super(s);
  6066.           brelse(bh);
  6067. --- 202,221 ----
  6068.       if (s->s_magic == MINIX_SUPER_MAGIC) {
  6069.           s->u.minix_sb.s_dirsize = 16;
  6070.           s->u.minix_sb.s_namelen = 14;
  6071. +         s->u.minix_sb.s_version = 0;
  6072.       } else if (s->s_magic == MINIX_SUPER_MAGIC2) {
  6073.           s->u.minix_sb.s_dirsize = 32;
  6074.           s->u.minix_sb.s_namelen = 30;
  6075. !         s->u.minix_sb.s_version = 0;
  6076. !     }
  6077. !     else if (s->s_magic == NEW_MINIX_SUPER_MAGIC)
  6078. !       {
  6079. !         s->u.minix_sb.s_dirsize = 16;
  6080. !         s->u.minix_sb.s_namelen = 14;
  6081. !         s->u.minix_sb.s_nzones = ms->s_zones;
  6082. !         s->u.minix_sb.s_version = 1;
  6083. !       }
  6084. !     else {
  6085.           s->s_dev = 0;
  6086.           unlock_super(s);
  6087.           brelse(bh);
  6088. ***************
  6089. *** 171,176 ****
  6090. --- 227,242 ----
  6091.           s->u.minix_sb.s_imap[i] = NULL;
  6092.       for (i=0;i < MINIX_Z_MAP_SLOTS;i++)
  6093.           s->u.minix_sb.s_zmap[i] = NULL;
  6094. +     if (s->u.minix_sb.s_imap_blocks > MINIX_I_MAP_SLOTS
  6095. +         || s->u.minix_sb.s_zmap_blocks > MINIX_Z_MAP_SLOTS)
  6096. +       {
  6097. +         s->s_dev = 0;
  6098. +         unlock_super (s);
  6099. +         brelse (bh);
  6100. +         if (!silent)
  6101. +           printk ("MINIX-fs: filesystem too big\n");
  6102. +         return NULL;
  6103. +       }
  6104.       block=2;
  6105.       for (i=0 ; i < s->u.minix_sb.s_imap_blocks ; i++)
  6106.           if ((s->u.minix_sb.s_imap[i]=bread(dev,block,BLOCK_SIZE)) != NULL)
  6107. ***************
  6108. *** 198,204 ****
  6109.       unlock_super(s);
  6110.       /* set up enough so that it can read an inode */
  6111.       s->s_dev = dev;
  6112. !     s->s_op = &minix_sops;
  6113.       s->s_mounted = iget(s,MINIX_ROOT_INO);
  6114.       if (!s->s_mounted) {
  6115.           s->s_dev = 0;
  6116. --- 264,273 ----
  6117.       unlock_super(s);
  6118.       /* set up enough so that it can read an inode */
  6119.       s->s_dev = dev;
  6120. !     if (s->u.minix_sb.s_version)
  6121. !       s->s_op = &minix_sops_v2;
  6122. !     else
  6123. !       s->s_op = &minix_sops;
  6124.       s->s_mounted = iget(s,MINIX_ROOT_INO);
  6125.       if (!s->s_mounted) {
  6126.           s->s_dev = 0;
  6127. ***************
  6128. *** 206,211 ****
  6129. --- 275,287 ----
  6130.           printk("MINIX-fs: get root inode failed\n");
  6131.           return NULL;
  6132.       }
  6133. +     if (!get_dirsize (s))
  6134. +       {
  6135. +         iput (s->s_mounted);
  6136. +         s->s_dev = 0;
  6137. +         brelse (bh);
  6138. +         return NULL;
  6139. +       }
  6140.       if (!(s->s_flags & MS_RDONLY)) {
  6141.           ms->s_state &= ~MINIX_VALID_FS;
  6142.           bh->b_dirt = 1;
  6143. ***************
  6144. *** 239,244 ****
  6145. --- 315,321 ----
  6146.   }
  6147.   
  6148.   #define inode_bmap(inode,nr) ((inode)->u.minix_i.i_data[(nr)])
  6149. + #define inode_bmap2(inode,nr) ((inode)->u.minix_i.i_data2[(nr)])
  6150.   
  6151.   static int block_bmap(struct buffer_head * bh, int nr)
  6152.   {
  6153. ***************
  6154. *** 251,256 ****
  6155. --- 328,345 ----
  6156.       return tmp;
  6157.   }
  6158.   
  6159. + static int
  6160. + block_bmap2 (struct buffer_head *bh, int nr)
  6161. + {
  6162. +   int tmp;
  6163. +   if (!bh)
  6164. +     return 0;
  6165. +   tmp = ((unsigned long *) bh->b_data)[nr];
  6166. +   brelse (bh);
  6167. +   return tmp;
  6168. + }
  6169.   int minix_bmap(struct inode * inode,int block)
  6170.   {
  6171.       int i;
  6172. ***************
  6173. *** 259,264 ****
  6174. --- 348,390 ----
  6175.           printk("minix_bmap: block<0");
  6176.           return 0;
  6177.       }
  6178. +     if (inode->i_sb->u.minix_sb.s_version)
  6179. +       {
  6180. +         int ind_nr;
  6181. +         if (block >= 7 + 256 + 256 * 256 * 2)
  6182. +           {
  6183. +         printk ("minix_bmap2: block > big");
  6184. +         return 0;
  6185. +           }
  6186. +         if (block < 7)
  6187. +           return inode_bmap2 (inode, block);
  6188. +         block -= 7;
  6189. +         if (block < 256)
  6190. +           {
  6191. +         i = inode_bmap2 (inode, 7);
  6192. +         if (!i)
  6193. +           return 0;
  6194. +         return block_bmap2 (bread (inode->i_dev, i, BLOCK_SIZE),
  6195. +                     block);
  6196. +           }
  6197. +         block -= 256;
  6198. +         if (block >= 256 * 256)
  6199. +           {
  6200. +         ind_nr = 9;
  6201. +         block -= 256 * 256;
  6202. +           }
  6203. +         else
  6204. +           ind_nr = 8;
  6205. +         i = inode_bmap2 (inode, ind_nr);
  6206. +         if (!i)
  6207. +           return 0;
  6208. +         i = block_bmap2 (bread (inode->i_dev, i, BLOCK_SIZE), block >> 8);
  6209. +         if (!i)
  6210. +           return 0;
  6211. +         return block_bmap2 (bread (inode->i_dev, i, BLOCK_SIZE),
  6212. +                 block & 255);
  6213. +       }
  6214.       if (block >= 7+512+512*512) {
  6215.           printk("minix_bmap: block>big");
  6216.           return 0;
  6217. ***************
  6218. *** 315,320 ****
  6219. --- 441,482 ----
  6220.       return result;
  6221.   }
  6222.   
  6223. + static struct buffer_head *
  6224. + inode_getblk2 (struct inode *inode, int nr, int create)
  6225. + {
  6226. +   int tmp;
  6227. +   unsigned long *p;
  6228. +   struct buffer_head *result;
  6229. +   p = inode->u.minix_i.i_data2 + nr;
  6230. + repeat:
  6231. +   tmp = *p;
  6232. +   if (tmp)
  6233. +     {
  6234. +       result = getblk (inode->i_dev, tmp, BLOCK_SIZE);
  6235. +       if (tmp == *p)
  6236. +     return result;
  6237. +       brelse (result);
  6238. +       goto repeat;
  6239. +     }
  6240. +   if (!create)
  6241. +     return NULL;
  6242. +   tmp = minix_new_block (inode->i_sb);
  6243. +   if (!tmp)
  6244. +     return NULL;
  6245. +   result = getblk (inode->i_dev, tmp, BLOCK_SIZE);
  6246. +   if (*p)
  6247. +     {
  6248. +       minix_free_block (inode->i_sb, tmp);
  6249. +       brelse (result);
  6250. +       goto repeat;
  6251. +     }
  6252. +   *p = tmp;
  6253. +   inode->i_ctime = CURRENT_TIME;
  6254. +   inode->i_dirt = 1;
  6255. +   return result;
  6256. + }
  6257.   static struct buffer_head * block_getblk(struct inode * inode,
  6258.       struct buffer_head * bh, int nr, int create)
  6259.   {
  6260. ***************
  6261. *** 365,370 ****
  6262. --- 527,589 ----
  6263.       return result;
  6264.   }
  6265.   
  6266. + static struct buffer_head *
  6267. + block_getblk2 (struct inode *inode, struct buffer_head *bh, int nr, int create)
  6268. + {
  6269. +   int tmp;
  6270. +   unsigned long *p;
  6271. +   struct buffer_head *result;
  6272. +   if (!bh)
  6273. +     return NULL;
  6274. +   if (!bh->b_uptodate)
  6275. +     {
  6276. +       ll_rw_block (READ, 1, &bh);
  6277. +       wait_on_buffer (bh);
  6278. +       if (!bh->b_uptodate)
  6279. +     {
  6280. +       brelse (bh);
  6281. +       return NULL;
  6282. +     }
  6283. +     }
  6284. +   p = nr + (unsigned long *) bh->b_data;
  6285. +  repeat:
  6286. +   tmp = *p;
  6287. +   if (tmp)
  6288. +     {
  6289. +       result = getblk (bh->b_dev, tmp, BLOCK_SIZE);
  6290. +       if (tmp == *p)
  6291. +     {
  6292. +       brelse (bh);
  6293. +       return result;
  6294. +     }
  6295. +       brelse (result);
  6296. +       goto repeat;
  6297. +     }
  6298. +   if (!create)
  6299. +     {
  6300. +       brelse (bh);
  6301. +       return NULL;
  6302. +     }
  6303. +   tmp = minix_new_block (inode->i_sb);
  6304. +   if (!tmp)
  6305. +     {
  6306. +       brelse (bh);
  6307. +       return NULL;
  6308. +     }
  6309. +   result = getblk (bh->b_dev, tmp, BLOCK_SIZE);
  6310. +   if (*p)
  6311. +     {
  6312. +       minix_free_block (inode->i_sb,tmp);
  6313. +       brelse (result);
  6314. +       goto repeat;
  6315. +     }
  6316. +   *p = tmp;
  6317. +   bh->b_dirt = 1;
  6318. +   brelse (bh);
  6319. +   return result;
  6320. + }
  6321.   struct buffer_head * minix_getblk(struct inode * inode, int block, int create)
  6322.   {
  6323.       struct buffer_head * bh;
  6324. ***************
  6325. *** 373,378 ****
  6326. --- 592,626 ----
  6327.           printk("minix_getblk: block<0");
  6328.           return NULL;
  6329.       }
  6330. +     if (inode->i_sb->u.minix_sb.s_version)
  6331. +       {
  6332. +         int ind_nr;
  6333. +         if (block >= 7 + 256 + 256 * 256 * 2)
  6334. +           {
  6335. +         printk ("minix_getblk: block > big");
  6336. +         return NULL;
  6337. +           }
  6338. +         if (block < 7)
  6339. +           return inode_getblk2 (inode, block, create);
  6340. +         block -= 7;
  6341. +         if (block < 256)
  6342. +           {
  6343. +         bh = inode_getblk2 (inode, 7, create);
  6344. +         return block_getblk2 (inode, bh, block, create);
  6345. +           }
  6346. +         block -= 256;
  6347. +         if (block >= 256 * 256)
  6348. +           {
  6349. +         ind_nr = 9;
  6350. +         block -= 256 * 256;
  6351. +           }
  6352. +         else
  6353. +           ind_nr = 8;
  6354. +         bh = inode_getblk2 (inode, ind_nr, create);
  6355. +         bh = block_getblk2 (inode, bh, block >> 8, create);
  6356. +         return block_getblk2 (inode, bh, block & 255, create);
  6357. +       }
  6358.       if (block >= 7+512+512*512) {
  6359.           printk("minix_getblk: block>big");
  6360.           return NULL;
  6361. ***************
  6362. *** 455,460 ****
  6363. --- 703,764 ----
  6364.           init_fifo(inode);
  6365.   }
  6366.   
  6367. + void
  6368. + minix_read_inode2 (struct inode *inode)
  6369. + {
  6370. +   struct buffer_head *bh;
  6371. +   struct new_minix_inode *raw_inode;
  6372. +   int block, ino;
  6373. +   ino = inode->i_ino;
  6374. +   inode->i_op = NULL;
  6375. +   inode->i_mode = 0;
  6376. +   if (!ino || (ulong) ino >= inode->i_sb->u.minix_sb.s_ninodes)
  6377. +     {
  6378. +       printk ("Bad inode number on dev 0x%04x: %d is out of range\n",
  6379. +           inode->i_dev, ino);
  6380. +       return;
  6381. +     }
  6382. +   block = (2 + inode->i_sb->u.minix_sb.s_imap_blocks
  6383. +        + inode->i_sb->u.minix_sb.s_zmap_blocks
  6384. +        + (ino - 1) / MINIX_INODES_PER_BLOCK2);
  6385. +   bh = bread (inode->i_dev,block, BLOCK_SIZE);
  6386. +   if (!bh)
  6387. +     {
  6388. +       printk ("Major problem: unable to read inode from dev 0x%04x\n",
  6389. +           inode->i_dev);
  6390. +       return;
  6391. +     }
  6392. +   raw_inode = ((struct new_minix_inode *) bh->b_data
  6393. +            + (ino - 1) % MINIX_INODES_PER_BLOCK2);
  6394. +   inode->i_mode = raw_inode->i_mode;
  6395. +   inode->i_uid = raw_inode->i_uid;
  6396. +   inode->i_gid = raw_inode->i_gid;
  6397. +   inode->i_nlink = raw_inode->i_nlinks;
  6398. +   inode->i_size = raw_inode->i_size;
  6399. +   inode->i_mtime = raw_inode->i_mtime;
  6400. +   inode->i_atime = raw_inode->i_atime;
  6401. +   inode->i_ctime = raw_inode->i_ctime;
  6402. +   inode->i_blocks = inode->i_blksize = 0;
  6403. +   if (S_ISCHR (inode->i_mode) || S_ISBLK (inode->i_mode))
  6404. +     inode->i_rdev = raw_inode->i_zone[0];
  6405. +   else for (block = 0; block < 10; block++)
  6406. +     inode->u.minix_i.i_data2[block] = raw_inode->i_zone[block];
  6407. +   brelse (bh);
  6408. +   if (S_ISREG (inode->i_mode))
  6409. +     inode->i_op = &minix_file_inode_operations;
  6410. +   else if (S_ISDIR (inode->i_mode))
  6411. +     inode->i_op = &minix_dir_inode_operations;
  6412. +   else if (S_ISLNK (inode->i_mode))
  6413. +     inode->i_op = &minix_symlink_inode_operations;
  6414. +   else if (S_ISCHR (inode->i_mode))
  6415. +     inode->i_op = &chrdev_inode_operations;
  6416. +   else if (S_ISBLK (inode->i_mode))
  6417. +     inode->i_op = &blkdev_inode_operations;
  6418. +   else if (S_ISFIFO (inode->i_mode))
  6419. +     init_fifo (inode);
  6420. + }
  6421.   static struct buffer_head * minix_update_inode(struct inode * inode)
  6422.   {
  6423.       struct buffer_head * bh;
  6424. ***************
  6425. *** 492,501 ****
  6426.       return bh;
  6427.   }
  6428.   
  6429.   void minix_write_inode(struct inode * inode)
  6430.   {
  6431.       struct buffer_head *bh;
  6432. !     bh = minix_update_inode(inode);
  6433.       brelse(bh);
  6434.   }
  6435.   
  6436. --- 796,853 ----
  6437.       return bh;
  6438.   }
  6439.   
  6440. + static struct buffer_head *
  6441. + minix_update_inode2 (struct inode *inode)
  6442. + {
  6443. +   struct buffer_head *bh;
  6444. +   struct new_minix_inode *raw_inode;
  6445. +   int ino, block;
  6446. +   ino = inode->i_ino;
  6447. +   if (!ino || (ulong) ino >= inode->i_sb->u.minix_sb.s_ninodes)
  6448. +     {
  6449. +       printk ("Bad inode number on dev 0x%04x: %d is out of range\n",
  6450. +           inode->i_dev, ino);
  6451. +       inode->i_dirt = 0;
  6452. +       return 0;
  6453. +     }
  6454. +   block = (2 + inode->i_sb->u.minix_sb.s_imap_blocks
  6455. +        + inode->i_sb->u.minix_sb.s_zmap_blocks
  6456. +        + (ino - 1) / MINIX_INODES_PER_BLOCK2);
  6457. +   bh = bread (inode->i_dev, block, BLOCK_SIZE);
  6458. +   if (!bh)
  6459. +     {
  6460. +       printk ("unable to read i-node block\n");
  6461. +       inode->i_dirt = 0;
  6462. +       return 0;
  6463. +     }
  6464. +   raw_inode = ((struct new_minix_inode *) bh->b_data
  6465. +            + (ino - 1) % MINIX_INODES_PER_BLOCK2);
  6466. +   raw_inode->i_mode = inode->i_mode;
  6467. +   raw_inode->i_uid = inode->i_uid;
  6468. +   raw_inode->i_gid = inode->i_gid;
  6469. +   raw_inode->i_nlinks = inode->i_nlink;
  6470. +   raw_inode->i_size = inode->i_size;
  6471. +   raw_inode->i_atime = inode->i_atime;
  6472. +   raw_inode->i_mtime = inode->i_mtime;
  6473. +   raw_inode->i_ctime = inode->i_ctime;
  6474. +   if (S_ISCHR (inode->i_mode) || S_ISBLK (inode->i_mode))
  6475. +     raw_inode->i_zone[0] = inode->i_rdev;
  6476. +   else
  6477. +     for (block = 0; block < 10; block++)
  6478. +       raw_inode->i_zone[block] = inode->u.minix_i.i_data2[block];
  6479. +   inode->i_dirt = 0;
  6480. +   bh->b_dirt = 1;
  6481. +   return bh;
  6482. + }
  6483.   void minix_write_inode(struct inode * inode)
  6484.   {
  6485.       struct buffer_head *bh;
  6486. !     if (inode->i_sb->u.minix_sb.s_version)
  6487. !       bh = minix_update_inode2 (inode);
  6488. !     else
  6489. !       bh = minix_update_inode(inode);
  6490.       brelse(bh);
  6491.   }
  6492.   
  6493. ***************
  6494. *** 525,530 ****
  6495. --- 877,914 ----
  6496.     raw_inode = ((struct minix_inode *) bh->b_data
  6497.              + (ino - 1) % MINIX_INODES_PER_BLOCK);
  6498.     raw_inode->i_nlinks = 0;
  6499. +   raw_inode->i_mode = 0;
  6500. +   bh->b_dirt = 1;
  6501. +   return bh;
  6502. + }
  6503. + static struct buffer_head *
  6504. + minix_clear_link2 (struct inode *inode)
  6505. + {
  6506. +   struct buffer_head *bh;
  6507. +   struct new_minix_inode *raw_inode;
  6508. +   int ino, block;
  6509. +   ino = inode->i_ino;
  6510. +   if (!ino || (ulong) ino >= inode->i_sb->u.minix_sb.s_ninodes)
  6511. +     {
  6512. +       printk ("Bad inode number on dev 0x%04x: %d is out of range\n",
  6513. +           inode->i_dev, ino);
  6514. +       return 0;
  6515. +     }
  6516. +   block = (2 + inode->i_sb->u.minix_sb.s_imap_blocks
  6517. +        + inode->i_sb->u.minix_sb.s_zmap_blocks
  6518. +        + (ino - 1) / MINIX_INODES_PER_BLOCK2);
  6519. +   bh = bread (inode->i_dev, block, BLOCK_SIZE);
  6520. +   if (!bh)
  6521. +     {
  6522. +       printk ("unable to read i-node block\n");
  6523. +       return 0;
  6524. +     }
  6525. +   raw_inode = ((struct new_minix_inode *) bh->b_data
  6526. +            + (ino - 1) % MINIX_INODES_PER_BLOCK2);
  6527. +   raw_inode->i_nlinks = 0;
  6528. +   raw_inode->i_mode = 0;
  6529.     bh->b_dirt = 1;
  6530.     return bh;
  6531.   }
  6532. ***************
  6533. *** 533,539 ****
  6534.   minix_clear_inode (struct inode *inode)
  6535.   {
  6536.     struct buffer_head *bh;
  6537. !   bh = minix_clear_link (inode);
  6538.     brelse (bh);
  6539.   }
  6540.   
  6541. --- 917,926 ----
  6542.   minix_clear_inode (struct inode *inode)
  6543.   {
  6544.     struct buffer_head *bh;
  6545. !   if (inode->i_sb->u.minix_sb.s_version)
  6546. !     bh = minix_clear_link2 (inode);
  6547. !   else
  6548. !     bh = minix_clear_link (inode);
  6549.     brelse (bh);
  6550.   }
  6551.   
  6552. ***************
  6553. *** 542,548 ****
  6554.       int err = 0;
  6555.       struct buffer_head *bh;
  6556.   
  6557. !     bh = minix_update_inode(inode);
  6558.       if (bh && bh->b_dirt)
  6559.       {
  6560.           ll_rw_block(WRITE, 1, &bh);
  6561. --- 929,938 ----
  6562.       int err = 0;
  6563.       struct buffer_head *bh;
  6564.   
  6565. !     if (inode->i_sb->u.minix_sb.s_version)
  6566. !       bh = minix_update_inode2 (inode);
  6567. !     else
  6568. !       bh = minix_update_inode(inode);
  6569.       if (bh && bh->b_dirt)
  6570.       {
  6571.           ll_rw_block(WRITE, 1, &bh);
  6572. diff -cr --new-file linux-0.9pl1/fs/minix/truncate.c linux-0.9pl2/fs/minix/truncate.c
  6573. *** linux-0.9pl1/fs/minix/truncate.c    Tue Jun  7 19:38:59 1994
  6574. --- linux-0.9pl2/fs/minix/truncate.c    Fri Aug  5 12:46:43 1994
  6575. ***************
  6576. *** 3,8 ****
  6577. --- 3,10 ----
  6578.    *
  6579.    *  Copyright (C) 1991, 1992  Linus Torvalds
  6580.    *
  6581. +  *  Extended for v2 filesystem by Andreas Schwab 1994
  6582. +  *
  6583.    * This file is subject to the terms and conditions of the GNU General Public
  6584.    * License.  See the file README.legal in the main directory of this archive
  6585.    * for more details.
  6586. ***************
  6587. *** 58,63 ****
  6588. --- 60,101 ----
  6589.       return retry;
  6590.   }
  6591.   
  6592. + static int
  6593. + trunc_direct2 (struct inode *inode)
  6594. + {
  6595. +   unsigned long *p;
  6596. +   struct buffer_head *bh;
  6597. +   int i, tmp;
  6598. +   int retry = 0;
  6599. + #define DIRECT_BLOCK2 ((inode->i_size + 1023) >> 10)
  6600. + repeat:
  6601. +   for (i = DIRECT_BLOCK2; i < 7; i++)
  6602. +     {
  6603. +       p = i + inode->u.minix_i.i_data2;
  6604. +       tmp = *p;
  6605. +       if (!tmp)
  6606. +     continue;
  6607. +       bh = get_hash_table (inode->i_dev, tmp, BLOCK_SIZE);
  6608. +       if (i < DIRECT_BLOCK2)
  6609. +     {
  6610. +       brelse (bh);
  6611. +       goto repeat;
  6612. +     }
  6613. +       if ((bh && bh->b_count != 1) || tmp != *p)
  6614. +     {
  6615. +       retry = 1;
  6616. +       brelse (bh);
  6617. +       continue;
  6618. +     }
  6619. +       *p = 0;
  6620. +       inode->i_dirt = 1;
  6621. +       brelse (bh);
  6622. +       minix_free_block (inode->i_sb, tmp);
  6623. +     }
  6624. +   return retry;
  6625. + }
  6626.   static int trunc_indirect(struct inode * inode, int offset, unsigned short * p)
  6627.   {
  6628.       struct buffer_head * bh;
  6629. ***************
  6630. *** 119,124 ****
  6631. --- 157,233 ----
  6632.       brelse(ind_bh);
  6633.       return retry;
  6634.   }
  6635. + static int
  6636. + trunc_indirect2 (struct inode *inode, int offset, unsigned long *p)
  6637. + {
  6638. +   struct buffer_head *bh;
  6639. +   int i, tmp;
  6640. +   struct buffer_head *ind_bh;
  6641. +   unsigned long *ind;
  6642. +   int retry = 0;
  6643. + #define INDIRECT_BLOCK2 (DIRECT_BLOCK2 - offset)
  6644. +   tmp = *p;
  6645. +   if (!tmp)
  6646. +     return 0;
  6647. +   ind_bh = bread (inode->i_dev, tmp, BLOCK_SIZE);
  6648. +   if (tmp != *p)
  6649. +     {
  6650. +       brelse (ind_bh);
  6651. +       return 1;
  6652. +     }
  6653. +   if (!ind_bh)
  6654. +     {
  6655. +       *p = 0;
  6656. +       return 0;
  6657. +     }
  6658. + repeat:
  6659. +   for (i = INDIRECT_BLOCK2; i < 256; i++)
  6660. +     {
  6661. +       if (i < 0)
  6662. +     i = 0;
  6663. +       if (i < INDIRECT_BLOCK2)
  6664. +     goto repeat;
  6665. +       ind = i + (unsigned long *) ind_bh->b_data;
  6666. +       tmp = *ind;
  6667. +       if (!tmp)
  6668. +     continue;
  6669. +       bh = get_hash_table (inode->i_dev, tmp, BLOCK_SIZE);
  6670. +       if (i < INDIRECT_BLOCK2)
  6671. +     {
  6672. +       brelse (bh);
  6673. +       goto repeat;
  6674. +     }
  6675. +       if ((bh && bh->b_count != 1) || tmp != *ind)
  6676. +     {
  6677. +       retry = 1;
  6678. +       brelse (bh);
  6679. +       continue;
  6680. +     }
  6681. +       *ind = 0;
  6682. +       ind_bh->b_dirt = 1;
  6683. +       brelse (bh);
  6684. +       minix_free_block (inode->i_sb, tmp);
  6685. +     }
  6686. +   ind = (unsigned long *) ind_bh->b_data;
  6687. +   for (i = 0; i < 256; i++)
  6688. +     if (*ind++)
  6689. +       break;
  6690. +   if (i >= 256)
  6691. +     {
  6692. +       if (ind_bh->b_count != 1)
  6693. +     retry = 1;
  6694. +       else
  6695. +     {
  6696. +       tmp = *p;
  6697. +       *p = 0;
  6698. +       minix_free_block (inode->i_sb, tmp);
  6699. +     }
  6700. +     }
  6701. +   brelse (ind_bh);
  6702. +   return retry;
  6703. + }
  6704.           
  6705.   static int trunc_dindirect(struct inode * inode)
  6706.   {
  6707. ***************
  6708. *** 166,171 ****
  6709. --- 275,334 ----
  6710.       brelse(dind_bh);
  6711.       return retry;
  6712.   }
  6713. + static int
  6714. + trunc_dindirect2 (struct inode *inode, int nr)
  6715. + {
  6716. +   int i, tmp;
  6717. +   struct buffer_head *dind_bh;
  6718. +   unsigned long *dind, *p;
  6719. +   int retry = 0;
  6720. +   int offset = nr ? 256 * 256 : 0;
  6721. + #define DINDIRECT_BLOCK2 ((DIRECT_BLOCK2 - (256 + 7) - offset) >> 8)
  6722. +   p = 8 + nr + inode->u.minix_i.i_data2;
  6723. +   tmp = *p;
  6724. +   if (!tmp)
  6725. +     return 0;
  6726. +   dind_bh = bread (inode->i_dev, tmp, BLOCK_SIZE);
  6727. +   if (tmp != *p)
  6728. +     {
  6729. +       brelse (dind_bh);
  6730. +       return 1;
  6731. +     }
  6732. +   if (!dind_bh)
  6733. +     {
  6734. +       *p = 0;
  6735. +       return 0;
  6736. +     }
  6737. + repeat:
  6738. +   for (i = DINDIRECT_BLOCK2; i < 256; i++)
  6739. +     {
  6740. +       if (i < 0)
  6741. +     i = 0;
  6742. +       if (i < DINDIRECT_BLOCK2)
  6743. +     goto repeat;
  6744. +       dind = i + (unsigned long *) dind_bh->b_data;
  6745. +       retry |= trunc_indirect2 (inode, 7 + 256 + offset + (i << 8), dind);
  6746. +       dind_bh->b_dirt = 1;
  6747. +     }
  6748. +   dind = (unsigned long *) dind_bh->b_data;
  6749. +   for (i = 0; i < 256; i++)
  6750. +     if (*dind++)
  6751. +       break;
  6752. +   if (i >= 256)
  6753. +     if (dind_bh->b_count != 1)
  6754. +       retry = 1;
  6755. +     else
  6756. +       {
  6757. +     tmp = *p;
  6758. +     *p = 0;
  6759. +     inode->i_dirt = 1;
  6760. +     minix_free_block (inode->i_sb, tmp);
  6761. +       }
  6762. +   brelse (dind_bh);
  6763. +   return retry;
  6764. + }
  6765.           
  6766.   void minix_truncate(struct inode * inode)
  6767.   {
  6768. ***************
  6769. *** 175,183 ****
  6770.            S_ISLNK(inode->i_mode)))
  6771.           return;
  6772.       while (1) {
  6773. !         retry = trunc_direct(inode);
  6774. !         retry |= trunc_indirect(inode,7,inode->u.minix_i.i_data+7);
  6775. !         retry |= trunc_dindirect(inode);
  6776.           if (!retry)
  6777.               break;
  6778.           current->counter = 0;
  6779. --- 338,357 ----
  6780.            S_ISLNK(inode->i_mode)))
  6781.           return;
  6782.       while (1) {
  6783. !         if (inode->i_sb->u.minix_sb.s_version)
  6784. !           {
  6785. !             retry = trunc_direct2 (inode);
  6786. !             retry |= trunc_indirect2 (inode, 7,
  6787. !                           inode->u.minix_i.i_data2 + 7);
  6788. !             retry |= trunc_dindirect2 (inode, 0);
  6789. !             retry |= trunc_dindirect2 (inode, 1);
  6790. !           }
  6791. !         else
  6792. !           {
  6793. !             retry = trunc_direct(inode);
  6794. !             retry |= trunc_indirect(inode,7,inode->u.minix_i.i_data+7);
  6795. !             retry |= trunc_dindirect(inode);
  6796. !           }
  6797.           if (!retry)
  6798.               break;
  6799.           current->counter = 0;
  6800. diff -cr --new-file linux-0.9pl1/fs/msdos/namei.c linux-0.9pl2/fs/msdos/namei.c
  6801. *** linux-0.9pl1/fs/msdos/namei.c    Sun Jun 26 20:11:31 1994
  6802. --- linux-0.9pl2/fs/msdos/namei.c    Fri Aug  5 12:47:11 1994
  6803. ***************
  6804. *** 4,9 ****
  6805. --- 4,11 ----
  6806.    *  Written 1992,1993 by Werner Almesberger
  6807.    */
  6808.   
  6809. + #include <linux/autoconf.h>
  6810.   #include <asm/segment.h>
  6811.   
  6812.   #include <linux/sched.h>
  6813. ***************
  6814. *** 16,31 ****
  6815. --- 18,40 ----
  6816.   /* MS-DOS "device special files" */
  6817.   
  6818.   static char *reserved_names[] = {
  6819. + #ifndef CONFIG_ATARI /* GEMDOS is less stupid */
  6820.       "CON     ","PRN     ","NUL     ","AUX     ",
  6821.       "LPT1    ","LPT2    ","LPT3    ","LPT4    ",
  6822.       "COM1    ","COM2    ","COM3    ","COM4    ",
  6823. + #endif
  6824.       NULL };
  6825.   
  6826.   
  6827.   /* Characters that are undesirable in an MS-DOS file name */
  6828.     
  6829.   static char bad_chars[] = "*?<>|\"";
  6830. + #ifdef CONFIG_ATARI
  6831. + /* GEMDOS is less restrictive */
  6832. + static char bad_if_strict[] = " ";
  6833. + #else
  6834.   static char bad_if_strict[] = "+=,; ";
  6835. + #endif
  6836.   
  6837.   
  6838.   /* Formats an MS-DOS file name. Rejects invalid names. */
  6839. ***************
  6840. *** 44,50 ****
  6841. --- 53,63 ----
  6842.           while (len--) *res++ = '.';
  6843.           return 0;
  6844.       }
  6845. + #ifndef CONFIG_ATARI
  6846.       space = 1; /* disallow names starting with a dot */
  6847. + #else
  6848. +     space = 0; /* GEMDOS does not care */
  6849. + #endif
  6850.       c = 0;
  6851.       for (walk = res; len && walk-res < 8; walk++) {
  6852.               c = *name++;
  6853. diff -cr --new-file linux-0.9pl1/fs/proc/array.c linux-0.9pl2/fs/proc/array.c
  6854. *** linux-0.9pl1/fs/proc/array.c    Tue Jun 14 17:20:40 1994
  6855. --- linux-0.9pl2/fs/proc/array.c    Fri Aug  5 12:46:29 1994
  6856. ***************
  6857. *** 455,460 ****
  6858. --- 455,462 ----
  6859.         }
  6860.   #elif defined(__mc68000__)
  6861.         pagedir = (*p)->tss.pagedir_v;
  6862. +       if (pagedir)
  6863. +         {
  6864.         for (i = 0; i < NUM_L1_ENTRIES-1; ++i) {
  6865.               unsigned long *ptrp, *ptrpe;
  6866.           if ((ptbl = pagedir[i]) == 0) {
  6867. ***************
  6868. *** 493,498 ****
  6869. --- 495,501 ----
  6870.             }
  6871.           }
  6872.         }
  6873. +     }
  6874.   #endif /* arch */
  6875.       }
  6876.       return sprintf(buffer,"%d %d %d %d %d %d %d\n",
  6877. diff -cr --new-file linux-0.9pl1/include/asm/segment.h linux-0.9pl2/include/asm/segment.h
  6878. *** linux-0.9pl1/include/asm/segment.h    Tue Jun  7 19:38:20 1994
  6879. --- linux-0.9pl2/include/asm/segment.h    Sun Aug  7 15:26:59 1994
  6880. ***************
  6881. *** 68,73 ****
  6882. --- 68,74 ----
  6883.   
  6884.   static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
  6885.   {
  6886. +     if (n == 0) return;
  6887.       __asm__ __volatile__ ("1:\n\t"
  6888.                     "moveb %1@+,d0\n\t"
  6889.                     "movesb d0,%2@+\n\t"
  6890. ***************
  6891. *** 160,166 ****
  6892.               return;
  6893.           case 3:
  6894.               *(short *) to = get_user_word((const short *) from);
  6895. !             *(char *) to = get_user_byte(2+(const char *) from);
  6896.               return;
  6897.           case 4:
  6898.               *(int *) to = get_user_long((const int *) from);
  6899. --- 161,167 ----
  6900.               return;
  6901.           case 3:
  6902.               *(short *) to = get_user_word((const short *) from);
  6903. !             *(2+(char *) to) = get_user_byte(2+(const char *) from);
  6904.               return;
  6905.           case 4:
  6906.               *(int *) to = get_user_long((const int *) from);
  6907. diff -cr --new-file linux-0.9pl1/include/linux/atariconf.h linux-0.9pl2/include/linux/atariconf.h
  6908. *** linux-0.9pl1/include/linux/atariconf.h    Wed Jun 29 16:13:33 1994
  6909. --- linux-0.9pl2/include/linux/atariconf.h    Fri Aug  5 12:47:12 1994
  6910. ***************
  6911. *** 22,27 ****
  6912. --- 22,28 ----
  6913.   extern unsigned long atari_keyb_init(unsigned long);
  6914.   extern void atari_init_INTS (void);
  6915.   extern int atari_add_isr (unsigned long, isrfunc, int, void *);
  6916. + extern void atari_process_int (int level, struct intframe *fp);
  6917.   extern unsigned long atari_gettimeoffset (void);
  6918.   extern void atari_gettod (struct mktime *);
  6919.   extern void atari_check_partition (struct gendisk *hd, unsigned int dev);
  6920. ***************
  6921. *** 34,39 ****
  6922. --- 35,41 ----
  6923.   extern struct consw ata_con;
  6924.   
  6925.   
  6926. + #if 0
  6927.   /* This function tests for the presence of an address, specially a
  6928.    * hardware register address. It is called very early in the kernel
  6929.    * initialization process, when the VBR register isn't set up yet. On
  6930. ***************
  6931. *** 69,74 ****
  6932. --- 71,77 ----
  6933.   
  6934.       return( ret );
  6935.   }
  6936. + #endif
  6937.   
  6938.   static __inline__ void config_atari(void)
  6939.   {
  6940. ***************
  6941. *** 76,81 ****
  6942. --- 79,85 ----
  6943.       mach_keyb_init       = atari_keyb_init;
  6944.       mach_init_INTS       = atari_init_INTS;
  6945.       mach_add_isr         = atari_add_isr;
  6946. +     mach_process_int     = atari_process_int;
  6947.       mach_gettimeoffset   = atari_gettimeoffset;
  6948.       mach_gettod          = atari_gettod;
  6949.       mach_check_partition = atari_check_partition;
  6950. ***************
  6951. *** 83,92 ****
  6952. --- 87,99 ----
  6953.       mach_reset           = atari_reset;
  6954.       mach_floppy_init     = atari_floppy_init;
  6955.       mach_floppy_change   = atari_floppy_change;
  6956. + #ifdef CONFIG_ATARI_FALCON_IDE
  6957.       mach_hd_init     = atari_hd_init;
  6958.       mach_hd_setup     = atari_hd_setup;
  6959. + #endif
  6960.       conswitchp             = &ata_con;
  6961.   
  6962. + #if 0 /* ++andreas: this is now done in the bootstrapper */
  6963.       /* ++roman:
  6964.        * Determine hardware model: TT or Falcon (for now, others may be added)
  6965.        * This is done by probing access to certain hardware registers unique to
  6966. ***************
  6967. *** 106,111 ****
  6968. --- 113,122 ----
  6969.           printk( "unknown!\n" );
  6970.           panic( "Cannot determine Atari model.\n" );
  6971.       }
  6972. + #endif
  6973. +     /* allocator for memory that must reside in st-ram */
  6974. +     atari_stram_init ();
  6975.   }
  6976.   
  6977.   #endif /* linux/atariconf.h */
  6978. diff -cr --new-file linux-0.9pl1/include/linux/atarihw.h linux-0.9pl2/include/linux/atarihw.h
  6979. *** linux-0.9pl1/include/linux/atarihw.h    Sun Jun 26 20:09:18 1994
  6980. --- linux-0.9pl2/include/linux/atarihw.h    Fri Aug  5 12:47:12 1994
  6981. ***************
  6982. *** 18,23 ****
  6983. --- 18,27 ----
  6984.   
  6985.   #include <linux/types.h>
  6986.   
  6987. + /* Memory used for screen ram and stdma buffers */
  6988. + void atari_stram_init (void);
  6989. + void *atari_stram_alloc (long size);
  6990. + void atari_stram_free (void *);
  6991.   
  6992.   /* 
  6993.   ** Shifter  
  6994. ***************
  6995. *** 132,137 ****
  6996. --- 136,142 ----
  6997.     u_char dma_md;
  6998.     u_char char_dummy3;
  6999.     u_char dma_lo;
  7000. +   u_short fdc_speed;
  7001.    };
  7002.   # define dma_wd ((*(volatile struct DMA_WD *)FWD_BAS))
  7003.   /* alias */
  7004. diff -cr --new-file linux-0.9pl1/include/linux/atariints.h linux-0.9pl2/include/linux/atariints.h
  7005. *** linux-0.9pl1/include/linux/atariints.h    Sun Jun 26 20:09:19 1994
  7006. --- linux-0.9pl2/include/linux/atariints.h    Fri Aug  5 12:47:13 1994
  7007. ***************
  7008. *** 20,69 ****
  7009.   **
  7010.   */
  7011.   
  7012. ! #define IRQ_MFP_BUSY      (8)
  7013. ! #define IRQ_MFP_DCD       (9)
  7014. ! #define IRQ_MFP_CTS        (10)
  7015. ! #define IRQ_MFP_GPU       (11)
  7016. ! #define IRQ_MFP_TIMD      (12)
  7017. ! #define IRQ_MFP_TIMC      (13)
  7018. ! #define IRQ_MFP_ACIA      (14)
  7019. ! #define IRQ_MFP_FDC       (15)
  7020. ! #define IRQ_MFP_TIMB      (16)
  7021. ! #define IRQ_MFP_SERERR    (17)
  7022. ! #define IRQ_MFP_SEREMPT   (18)
  7023. ! #define IRQ_MFP_RECERR    (19)
  7024. ! #define IRQ_MFP_RECFULL   (20)
  7025. ! #define IRQ_MFP_TIMA      (21)
  7026. ! #define IRQ_MFP_RI        (22)
  7027. ! #define IRQ_MFP_MMD       (23)
  7028.   
  7029.   #define IRQ_FLOPPY        IRQ_MFP_FDC
  7030.   
  7031. ! #define IRQ_TT_MFP_IO0       (24)
  7032. ! #define IRQ_TT_MFP_IO1       (25)
  7033. ! #define IRQ_TT_MFP_SCC       (26)
  7034. ! #define IRQ_TT_MFP_RI          (27)
  7035. ! #define IRQ_TT_MFP_TIMD      (28)
  7036. ! #define IRQ_TT_MFP_TIMC         (29)
  7037. ! #define IRQ_TT_MFP_DRVRDY    (30)
  7038. ! #define IRQ_TT_MFP_SCSIDMA   (31)
  7039. ! #define IRQ_TT_MFP_TIMB      (32)
  7040. ! #define IRQ_TT_MFP_SERERR    (33)
  7041. ! #define IRQ_TT_MFP_SEREMPT   (34)
  7042. ! #define IRQ_TT_MFP_RECERR    (35)
  7043. ! #define IRQ_TT_MFP_RECFULL   (36)
  7044. ! #define IRQ_TT_MFP_TIMA      (37)
  7045. ! #define IRQ_TT_MFP_RTC       (38)
  7046. ! #define IRQ_TT_MFP_SCSI      (39)
  7047. ! #define    IRQ_SCCB_TX             (40)
  7048. ! #define    IRQ_SCCB_STAT         (42)
  7049. ! #define    IRQ_SCCB_RX             (44)
  7050. ! #define    IRQ_SCCB_SPCOND         (46)
  7051. ! #define    IRQ_SCCA_TX             (48)
  7052. ! #define    IRQ_SCCA_STAT         (50)
  7053. ! #define    IRQ_SCCA_RX             (52)
  7054. ! #define    IRQ_SCCA_SPCOND         (54)
  7055.   
  7056.   /* INTREQR masks */
  7057.   #define IRQ1_MASK   0x0007    /* INTREQR mask for IRQ 1 */
  7058. --- 20,74 ----
  7059.   **
  7060.   */
  7061.   
  7062. ! #define NUM_ATARI_SOURCES   (48)
  7063. ! #define STMFP_SOURCE_BASE   0
  7064. ! #define TTMFP_SOURCE_BASE   16
  7065. ! #define SCC_SOURCE_BASE        32
  7066. ! #define IRQ_MFP_BUSY      (IRQ_MACHSPEC | 0)
  7067. ! #define IRQ_MFP_DCD       (IRQ_MACHSPEC | 1)
  7068. ! #define IRQ_MFP_CTS        (IRQ_MACHSPEC | 2)
  7069. ! #define IRQ_MFP_GPU       (IRQ_MACHSPEC | 3)
  7070. ! #define IRQ_MFP_TIMD      (IRQ_MACHSPEC | 4)
  7071. ! #define IRQ_MFP_TIMC      (IRQ_MACHSPEC | 5)
  7072. ! #define IRQ_MFP_ACIA      (IRQ_MACHSPEC | 6)
  7073. ! #define IRQ_MFP_FDC       (IRQ_MACHSPEC | 7)
  7074. ! #define IRQ_MFP_TIMB      (IRQ_MACHSPEC | 8)
  7075. ! #define IRQ_MFP_SERERR    (IRQ_MACHSPEC | 9)
  7076. ! #define IRQ_MFP_SEREMPT   (IRQ_MACHSPEC | 10)
  7077. ! #define IRQ_MFP_RECERR    (IRQ_MACHSPEC | 11)
  7078. ! #define IRQ_MFP_RECFULL   (IRQ_MACHSPEC | 12)
  7079. ! #define IRQ_MFP_TIMA      (IRQ_MACHSPEC | 13)
  7080. ! #define IRQ_MFP_RI        (IRQ_MACHSPEC | 14)
  7081. ! #define IRQ_MFP_MMD       (IRQ_MACHSPEC | 15)
  7082.   
  7083.   #define IRQ_FLOPPY        IRQ_MFP_FDC
  7084.   
  7085. ! #define IRQ_TT_MFP_IO0       (IRQ_MACHSPEC | 16)
  7086. ! #define IRQ_TT_MFP_IO1       (IRQ_MACHSPEC | 17)
  7087. ! #define IRQ_TT_MFP_SCC         (IRQ_MACHSPEC | 18)
  7088. ! #define IRQ_TT_MFP_RI          (IRQ_MACHSPEC | 19)
  7089. ! #define IRQ_TT_MFP_TIMD      (IRQ_MACHSPEC | 20)
  7090. ! #define IRQ_TT_MFP_TIMC         (IRQ_MACHSPEC | 21)
  7091. ! #define IRQ_TT_MFP_DRVRDY    (IRQ_MACHSPEC | 22)
  7092. ! #define IRQ_TT_MFP_SCSIDMA   (IRQ_MACHSPEC | 23)
  7093. ! #define IRQ_TT_MFP_TIMB      (IRQ_MACHSPEC | 24)
  7094. ! #define IRQ_TT_MFP_SERERR    (IRQ_MACHSPEC | 25)
  7095. ! #define IRQ_TT_MFP_SEREMPT   (IRQ_MACHSPEC | 26)
  7096. ! #define IRQ_TT_MFP_RECERR    (IRQ_MACHSPEC | 27)
  7097. ! #define IRQ_TT_MFP_RECFULL   (IRQ_MACHSPEC | 28)
  7098. ! #define IRQ_TT_MFP_TIMA      (IRQ_MACHSPEC | 29)
  7099. ! #define IRQ_TT_MFP_RTC       (IRQ_MACHSPEC | 30)
  7100. ! #define IRQ_TT_MFP_SCSI      (IRQ_MACHSPEC | 31)
  7101. ! #define    IRQ_SCCB_TX         (IRQ_MACHSPEC | 32)
  7102. ! #define    IRQ_SCCB_STAT         (IRQ_MACHSPEC | 34)
  7103. ! #define    IRQ_SCCB_RX         (IRQ_MACHSPEC | 36)
  7104. ! #define    IRQ_SCCB_SPCOND         (IRQ_MACHSPEC | 38)
  7105. ! #define    IRQ_SCCA_TX         (IRQ_MACHSPEC | 40)
  7106. ! #define    IRQ_SCCA_STAT         (IRQ_MACHSPEC | 42)
  7107. ! #define    IRQ_SCCA_RX         (IRQ_MACHSPEC | 44)
  7108. ! #define    IRQ_SCCA_SPCOND         (IRQ_MACHSPEC | 46)
  7109.   
  7110.   /* INTREQR masks */
  7111.   #define IRQ1_MASK   0x0007    /* INTREQR mask for IRQ 1 */
  7112. ***************
  7113. *** 91,97 ****
  7114.   #define IF_I13    0x0002    
  7115.   #define IF_I14    0x0001    
  7116.   
  7117. ! #define INT_CLK   24576  /* CLK while int_clk =2.456MHz and divide = 100 */
  7118. ! #define INT_TICKS 246    /* to make sched_time = 99.9024 HZ */
  7119.   
  7120.   #endif /* linux/atariints.h */
  7121. --- 96,104 ----
  7122.   #define IF_I13    0x0002    
  7123.   #define IF_I14    0x0001    
  7124.   
  7125. ! /* ++andreas: INT_TICKS changed to make perfect 100 Hz clock */
  7126. ! #define INT_CLK   24576  /* CLK while int_clk =2.456MHz and divide = 64 */
  7127. ! #define INT_TICKS 384    /* to make sched_time = 100 HZ */
  7128.   
  7129.   #endif /* linux/atariints.h */
  7130. diff -cr --new-file linux-0.9pl1/include/linux/bootinfo.h linux-0.9pl2/include/linux/bootinfo.h
  7131. *** linux-0.9pl1/include/linux/bootinfo.h    Sun Jun 26 19:54:24 1994
  7132. --- linux-0.9pl2/include/linux/bootinfo.h    Fri Aug  5 12:47:14 1994
  7133. ***************
  7134. *** 62,70 ****
  7135.   
  7136.   struct bi_Atari {
  7137.       AtariModel    model;
  7138. !     /* needs not be initialized by bootstrap! ---
  7139. !        model is determined at run time in
  7140. !        config_atari() */
  7141.   };
  7142.   
  7143.   /*
  7144. --- 62,69 ----
  7145.   
  7146.   struct bi_Atari {
  7147.       AtariModel    model;
  7148. !     unsigned long stram_start;    /* Start of unmapped ST-RAM */
  7149. !     unsigned long stram_size;    /* Size of unmapped ST-RAM */
  7150.   };
  7151.   
  7152.   /*
  7153. diff -cr --new-file linux-0.9pl1/include/linux/config.h linux-0.9pl2/include/linux/config.h
  7154. *** linux-0.9pl1/include/linux/config.h    Wed Jun 29 16:17:07 1994
  7155. --- linux-0.9pl2/include/linux/config.h    Fri Aug  5 12:47:14 1994
  7156. ***************
  7157. *** 48,53 ****
  7158. --- 48,54 ----
  7159.   extern void (*mach_init_INTS) (void);
  7160.   extern int (*mach_add_isr) (unsigned long source, isrfunc isr,
  7161.                   int pri, void *data);
  7162. + extern void (*mach_process_int) (int level, struct intframe *fp);
  7163.   extern unsigned long (*mach_gettimeoffset)(void);
  7164.   struct mktime;
  7165.   extern void (*mach_gettod)(struct mktime*);
  7166. diff -cr --new-file linux-0.9pl1/include/linux/console.h linux-0.9pl2/include/linux/console.h
  7167. *** linux-0.9pl1/include/linux/console.h    Sun Jun 26 23:40:29 1994
  7168. --- linux-0.9pl2/include/linux/console.h    Fri Aug  5 12:46:30 1994
  7169. ***************
  7170. *** 53,59 ****
  7171.       unsigned long    vc_ques        : 1;
  7172.       unsigned long    vc_need_wrap    : 1;
  7173.       unsigned long    vc_tab_stop[5];        /* Tab stops. 160 columns. */
  7174. -     unsigned char    vc_kbdmode;
  7175.       unsigned char * vc_translate;
  7176.       unsigned char *    vc_G0_charset;
  7177.       unsigned char *    vc_G1_charset;
  7178. --- 53,58 ----
  7179. diff -cr --new-file linux-0.9pl1/include/linux/fd.h linux-0.9pl2/include/linux/fd.h
  7180. *** linux-0.9pl1/include/linux/fd.h    Tue Jun  7 19:38:27 1994
  7181. --- linux-0.9pl2/include/linux/fd.h    Sun Aug  7 11:37:28 1994
  7182. ***************
  7183. *** 15,20 ****
  7184. --- 15,23 ----
  7185.   #define    FDFMTTRK 7 /* format the specified track */
  7186.   #define FDFMTEND 8 /* end formatting a disk */
  7187.   #define FDSETEMSGTRESH    10    /* set fdc error reporting treshold */
  7188. + #define FDFLUSH  11 /* flush buffers for media; either for verifying media, or 
  7189. +                for handling a media change without closing the file
  7190. +                descriptor */
  7191.   
  7192.   /*
  7193.   ** Misc definitions
  7194. diff -cr --new-file linux-0.9pl1/include/linux/interrupt.h linux-0.9pl2/include/linux/interrupt.h
  7195. *** linux-0.9pl1/include/linux/interrupt.h    Sun Jun 26 20:09:20 1994
  7196. --- linux-0.9pl2/include/linux/interrupt.h    Fri Aug  5 12:47:15 1994
  7197. ***************
  7198. *** 30,47 ****
  7199.   #define IRQ7         (7)    /* level 7 interrupt (non-maskable) */
  7200.   
  7201.   /*
  7202. -  * ++roman: Some machines have more than 7 interrupt sources!
  7203. -  */
  7204. - #ifdef CONFIG_ATARI
  7205. - # define    NUM_INT_SOURCES        56
  7206. - # define  FIRST_NONAUTO_VEC   64
  7207. - #else
  7208. - # define  NUM_INT_SOURCES 7
  7209. - #endif
  7210. - /*
  7211.    * "Generic" interrupt sources
  7212.    */
  7213.   
  7214. --- 30,35 ----
  7215. diff -cr --new-file linux-0.9pl1/include/linux/lp.h linux-0.9pl2/include/linux/lp.h
  7216. *** linux-0.9pl1/include/linux/lp.h    Tue Jun  7 19:38:29 1994
  7217. --- linux-0.9pl2/include/linux/lp.h    Fri Aug  5 13:37:43 1994
  7218. ***************
  7219. *** 3,14 ****
  7220. --- 3,18 ----
  7221.   
  7222.   /*
  7223.    * usr/include/linux/lp.h  modified for Amiga by Michael Rausch
  7224. +  * modified for Atari by Andreas Schwab
  7225.    *
  7226.    * linux i386 version  c.1991-1992 James Wiegand
  7227.    * many modifications copyright (C) 1992 Michael K. Johnson
  7228.    * Interrupt support added 1993 Nigel Gamble
  7229.    */
  7230.   
  7231. + #include <linux/autoconf.h>
  7232. + #include <linux/bootinfo.h>
  7233.   /*
  7234.    * Per POSIX guidelines, this module reserves the LP and lp prefixes
  7235.    * These are the lp_table[minor].flags flags...
  7236. ***************
  7237. *** 80,91 ****
  7238.   #define LP_NO 1
  7239.   
  7240.   
  7241. ! #define LP_OUT(c)    ciaa.prb = c
  7242.   
  7243.   /*  busy is low-active, and so are the cia bits */
  7244. ! #define LP_IS_BUSY    (ciab.pra & 1)
  7245. ! #define LP_HAS_POUT    (ciab.pra & 2)
  7246. ! #define LP_IS_ONLINE    (ciab.pra & 4)
  7247.   
  7248.   /*
  7249.    * function prototypes
  7250. --- 84,204 ----
  7251.   #define LP_NO 1
  7252.   
  7253.   
  7254. ! #define AMIGA_LP_OUT(c)    ciaa.prb = c
  7255.   
  7256.   /*  busy is low-active, and so are the cia bits */
  7257. ! #define AMIGA_LP_IS_BUSY()    (ciab.pra & 1)
  7258. ! #define AMIGA_LP_HAS_POUT()    (ciab.pra & 2)
  7259. ! #define AMIGA_LP_IS_ONLINE()    (ciab.pra & 4)
  7260. ! /* LP_OUT must be executed with interrupts blocked */
  7261. ! #define ATARI_LP_OUT(c) (sound_ym.rd_data_reg_sel = 15, \
  7262. !              sound_ym.wd_data = c, \
  7263. !              sound_ym.rd_data_reg_sel = 14, \
  7264. !              sound_ym.wd_data = sound_ym.rd_data_reg_sel & ~(1 << 5), \
  7265. !              udelay (1), \
  7266. !              sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5))
  7267. ! #define ATARI_LP_IS_BUSY()    (mfp.par_dt_reg & 1)
  7268. ! #define ATARI_LP_HAS_POUT()    0
  7269. ! #define ATARI_LP_IS_ONLINE()    !ATARI_LP_IS_BUSY() /* or 1 XXX */
  7270. ! #if defined (CONFIG_AMIGA) + defined (CONFIG_ATARI) == 1
  7271. ! #ifdef CONFIG_AMIGA
  7272. ! #define LP_OUT(c) AMIGA_LP_OUT(c)
  7273. ! #define LP_IS_BUSY() AMIGA_LP_IS_BUSY
  7274. ! #define LP_HAS_POUT() AMIGA_LP_HAS_POUT
  7275. ! #define LP_IS_ONLINE() AMIGA_LP_IS_ONLINE
  7276. ! #endif
  7277. ! #ifdef CONFIG_ATARI
  7278. ! #define LP_OUT(c) ATARI_LP_OUT(c)
  7279. ! #define LP_IS_BUSY() ATARI_LP_IS_BUSY
  7280. ! #define LP_HAS_POUT() ATARI_LP_HAS_POUT
  7281. ! #define LP_IS_ONLINE() ATARI_LP_IS_ONLINE
  7282. ! #endif
  7283. ! #else /* multi configuration */
  7284. ! static __inline__ void
  7285. ! LP_OUT (int c)
  7286. ! {
  7287. !   switch (boot_info.machtype)
  7288. !     {
  7289. ! #ifdef CONFIG_AMIGA
  7290. !     case MACH_AMIGA:
  7291. !       AMIGA_LP_OUT (c);
  7292. !       break;
  7293. ! #endif
  7294. ! #ifdef CONFIG_ATARI
  7295. !     case MACH_ATARI:
  7296. !       ATARI_LP_OUT (c);
  7297. !       break;
  7298. ! #endif
  7299. !     }
  7300. ! }
  7301. ! static __inline__ int
  7302. ! LP_IS_BUSY (void)
  7303. ! {
  7304. !   switch (boot_info.machtype)
  7305. !     {
  7306. ! #ifdef CONFIG_AMIGA
  7307. !     case MACH_AMIGA:
  7308. !       return AMIGA_LP_IS_BUSY ();
  7309. !       break;
  7310. ! #endif
  7311. ! #ifdef CONFIG_ATARI
  7312. !     case MACH_ATARI:
  7313. !       return ATARI_LP_IS_BUSY ();
  7314. !       break;
  7315. ! #endif
  7316. !     default:
  7317. !       return 0;
  7318. !     }
  7319. ! }
  7320. ! static __inline__ int
  7321. ! LP_HAS_POUT (void)
  7322. ! {
  7323. !   switch (boot_info.machtype)
  7324. !     {
  7325. ! #ifdef CONFIG_AMIGA
  7326. !     case MACH_AMIGA:
  7327. !       return AMIGA_LP_HAS_POUT ();
  7328. !       break;
  7329. ! #endif
  7330. ! #ifdef CONFIG_ATARI
  7331. !     case MACH_ATARI:
  7332. !       return ATARI_LP_HAS_POUT ();
  7333. !       break;
  7334. ! #endif
  7335. !     default:
  7336. !       return 0;
  7337. !     }
  7338. ! }
  7339. ! static __inline__ int
  7340. ! LP_IS_ONLINE (void)
  7341. ! {
  7342. !   switch (boot_info.machtype)
  7343. !     {
  7344. ! #ifdef CONFIG_AMIGA
  7345. !     case MACH_AMIGA:
  7346. !       return AMIGA_LP_IS_ONLINE ();
  7347. !       break;
  7348. ! #endif
  7349. ! #ifdef CONFIG_ATARI
  7350. !     case MACH_ATARI:
  7351. !       return ATARI_LP_IS_ONLINE ();
  7352. !       break;
  7353. ! #endif
  7354. !     default:
  7355. !       return 0;
  7356. !     }
  7357. ! }
  7358. ! #endif
  7359.   
  7360.   /*
  7361.    * function prototypes
  7362. diff -cr --new-file linux-0.9pl1/include/linux/minix_fs.h linux-0.9pl2/include/linux/minix_fs.h
  7363. *** linux-0.9pl1/include/linux/minix_fs.h    Tue Jun  7 19:38:24 1994
  7364. --- linux-0.9pl2/include/linux/minix_fs.h    Fri Aug  5 12:46:43 1994
  7365. ***************
  7366. *** 22,35 ****
  7367.   #define MINIX_LINK_MAX    250
  7368.   
  7369.   #define MINIX_I_MAP_SLOTS    8
  7370. ! #define MINIX_Z_MAP_SLOTS    8
  7371.   #define MINIX_SUPER_MAGIC    0x137F        /* original minix fs */
  7372.   #define MINIX_SUPER_MAGIC2    0x138F        /* minix fs, 30 char names */
  7373. ! #define NEW_MINIX_SUPER_MAGIC    0x2468        /* minix V2 - not implemented */
  7374.   #define MINIX_VALID_FS        0x0001        /* Clean fs. */
  7375.   #define MINIX_ERROR_FS        0x0002        /* fs has errors. */
  7376.   
  7377.   #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
  7378.   
  7379.   struct minix_inode {
  7380.       unsigned short i_mode;
  7381. --- 22,36 ----
  7382.   #define MINIX_LINK_MAX    250
  7383.   
  7384.   #define MINIX_I_MAP_SLOTS    8
  7385. ! #define MINIX_Z_MAP_SLOTS    64
  7386.   #define MINIX_SUPER_MAGIC    0x137F        /* original minix fs */
  7387.   #define MINIX_SUPER_MAGIC2    0x138F        /* minix fs, 30 char names */
  7388. ! #define NEW_MINIX_SUPER_MAGIC    0x2468        /* minix V2 */
  7389.   #define MINIX_VALID_FS        0x0001        /* Clean fs. */
  7390.   #define MINIX_ERROR_FS        0x0002        /* fs has errors. */
  7391.   
  7392.   #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
  7393. + #define MINIX_INODES_PER_BLOCK2 ((BLOCK_SIZE)/sizeof (struct new_minix_inode))
  7394.   
  7395.   struct minix_inode {
  7396.       unsigned short i_mode;
  7397. ***************
  7398. *** 72,77 ****
  7399. --- 73,79 ----
  7400.       unsigned long s_max_size;
  7401.       unsigned short s_magic;
  7402.       unsigned short s_state;
  7403. +     unsigned long s_zones;    /* long version of s_nzones for v2 */
  7404.   };
  7405.   
  7406.   struct minix_dir_entry {
  7407. ***************
  7408. *** 110,115 ****
  7409. --- 112,118 ----
  7410.   extern void minix_write_super(struct super_block *);
  7411.   extern int minix_remount (struct super_block * sb, int * flags, char * data);
  7412.   extern void minix_read_inode(struct inode *);
  7413. + extern void minix_read_inode2 (struct inode *);
  7414.   extern void minix_write_inode(struct inode *);
  7415.   extern void minix_clear_inode (struct inode *);
  7416.   extern void minix_put_inode(struct inode *);
  7417. diff -cr --new-file linux-0.9pl1/include/linux/minix_fs_i.h linux-0.9pl2/include/linux/minix_fs_i.h
  7418. *** linux-0.9pl1/include/linux/minix_fs_i.h    Tue Jun  7 19:38:24 1994
  7419. --- linux-0.9pl2/include/linux/minix_fs_i.h    Fri Aug  5 12:46:44 1994
  7420. ***************
  7421. *** 10,15 ****
  7422. --- 10,16 ----
  7423.    */
  7424.   struct minix_inode_info {
  7425.       unsigned short i_data[16];
  7426. +     unsigned long i_data2[16];
  7427.   };
  7428.   
  7429.   #endif
  7430. diff -cr --new-file linux-0.9pl1/include/linux/minix_fs_sb.h linux-0.9pl2/include/linux/minix_fs_sb.h
  7431. *** linux-0.9pl1/include/linux/minix_fs_sb.h    Tue Jun  7 19:38:24 1994
  7432. --- linux-0.9pl2/include/linux/minix_fs_sb.h    Fri Aug  5 12:46:44 1994
  7433. ***************
  7434. *** 17,25 ****
  7435.               unsigned long s_log_zone_size;
  7436.               unsigned long s_max_size;
  7437.               struct buffer_head * s_imap[8];
  7438. !             struct buffer_head * s_zmap[8];
  7439.               unsigned long s_dirsize;
  7440.               unsigned long s_namelen;
  7441.               struct buffer_head * s_sbh;
  7442.               struct minix_super_block * s_ms;
  7443.               unsigned short s_mount_state;
  7444. --- 17,26 ----
  7445.               unsigned long s_log_zone_size;
  7446.               unsigned long s_max_size;
  7447.               struct buffer_head * s_imap[8];
  7448. !             struct buffer_head * s_zmap[64];
  7449.               unsigned long s_dirsize;
  7450.               unsigned long s_namelen;
  7451. +             int s_version;
  7452.               struct buffer_head * s_sbh;
  7453.               struct minix_super_block * s_ms;
  7454.               unsigned short s_mount_state;
  7455. diff -cr --new-file linux-0.9pl1/include/linux/mm.h linux-0.9pl2/include/linux/mm.h
  7456. *** linux-0.9pl1/include/linux/mm.h    Tue Jun  7 19:38:28 1994
  7457. --- linux-0.9pl2/include/linux/mm.h    Fri Aug  5 12:46:31 1994
  7458. ***************
  7459. *** 32,39 ****
  7460.           return -EFAULT;
  7461.       if (size > TASK_SIZE - (unsigned long) addr)
  7462.           return -EFAULT;
  7463. ! #elif defined(__m368000_)
  7464. !     if (current->pid != 1 && TASK_SIZE <= (unsigned long addr)
  7465.           return -EFAULT;
  7466.       if (current->pid != 1 && size > TASK_SIZE - (unsigned long) addr)
  7467.           return -EFAULT;
  7468. --- 32,39 ----
  7469.           return -EFAULT;
  7470.       if (size > TASK_SIZE - (unsigned long) addr)
  7471.           return -EFAULT;
  7472. ! #elif defined(__m68000__)
  7473. !     if (current->pid != 1 && TASK_SIZE <= (unsigned long) addr)
  7474.           return -EFAULT;
  7475.       if (current->pid != 1 && size > TASK_SIZE - (unsigned long) addr)
  7476.           return -EFAULT;
  7477. diff -cr --new-file linux-0.9pl1/include/linux/ptrace.h linux-0.9pl2/include/linux/ptrace.h
  7478. *** linux-0.9pl1/include/linux/ptrace.h    Sun Jun 26 20:09:22 1994
  7479. --- linux-0.9pl2/include/linux/ptrace.h    Fri Aug  5 12:46:32 1994
  7480. ***************
  7481. *** 85,90 ****
  7482. --- 85,91 ----
  7483.   /* set's the trap flag. */
  7484.   #define TRAP_FLAG 0x100
  7485.   
  7486. + #ifdef __KERNEL__
  7487.   /*
  7488.    * this is the number to subtract from the top of the stack. To find
  7489.    * the local frame.
  7490. ***************
  7491. *** 101,106 ****
  7492. --- 102,109 ----
  7493.        tmp = ptrace_get_stack_long((child), \
  7494.                  sizeof(long)*EFL-MAGICNUMBER) & ~TRAP_FLAG; \
  7495.        ptrace_put_stack_long((child),sizeof(long)*EFL-MAGICNUMBER,tmp); } while(0)
  7496. + #endif /* __KERNEL__ */
  7497.   #elif defined(__mc68000__)
  7498.   
  7499.   #define PT_D1       0
  7500. ***************
  7501. *** 149,154 ****
  7502. --- 152,158 ----
  7503.     short sr;
  7504.     long    pc;
  7505.     short fmtvec;
  7506. +   short __fill;            /* to make it longword aligned */
  7507.   };
  7508.   
  7509.   /* determines which bits in the SR the user has access to. */
  7510. ***************
  7511. *** 158,163 ****
  7512. --- 162,168 ----
  7513.   /* sets the trace bits. */
  7514.   #define TRACE_BITS 0x8000
  7515.   
  7516. + #ifdef __KERNEL__
  7517.   #define ptrace_setsingle(child)    \
  7518.   do { long tmp;                     \
  7519.        tmp = ptrace_get_stack_long((child), \
  7520. ***************
  7521. *** 168,182 ****
  7522. --- 173,191 ----
  7523.        tmp = ptrace_get_stack_long((child), \
  7524.                  sizeof(long)*PT_SR) & ~TRACE_BITS; \
  7525.        ptrace_put_stack_long((child),sizeof(long)*PT_SR,tmp); } while(0)
  7526. + #endif /* __KERNEL__ */
  7527.   #else
  7528.   #error Architecture not supported
  7529.   #endif /* architecture */
  7530.   
  7531. + #ifdef __KERNEL__
  7532.   extern int ptrace_put_stack_long (struct task_struct *, int, unsigned long);
  7533.   extern int ptrace_get_stack_long (struct task_struct *, int);
  7534.   extern int ptrace_read_long(struct task_struct *, long, unsigned long *);
  7535.   extern int ptrace_write_long(struct task_struct *, long, long);
  7536.   extern int ptrace_peekusr(struct task_struct *, long, long);
  7537.   extern int ptrace_pokeusr(struct task_struct *, long, long);
  7538. + #endif
  7539.   
  7540.   #endif /* _LINUX_PTRACE_H */
  7541. diff -cr --new-file linux-0.9pl1/include/linux/traps.h linux-0.9pl2/include/linux/traps.h
  7542. *** linux-0.9pl1/include/linux/traps.h    Sun Jun 26 20:09:22 1994
  7543. --- linux-0.9pl2/include/linux/traps.h    Fri Aug  5 12:47:17 1994
  7544. ***************
  7545. *** 224,230 ****
  7546.    * as seen by an interrupt handler routine.
  7547.    */
  7548.   struct intframe {
  7549. -     unsigned long  regs[4];      /* d0-d1,a0-a1 */
  7550.       unsigned short sr;         /* status register */
  7551.       unsigned long  pc;         /* program counter */
  7552.       unsigned       format :  4;  /* frame format specifier */
  7553. --- 224,229 ----
  7554. diff -cr --new-file linux-0.9pl1/include/linux/user.h linux-0.9pl2/include/linux/user.h
  7555. *** linux-0.9pl1/include/linux/user.h    Tue Jun  7 19:38:26 1994
  7556. --- linux-0.9pl2/include/linux/user.h    Fri Aug  5 12:46:32 1994
  7557. ***************
  7558. *** 47,54 ****
  7559.   };
  7560.   
  7561.   struct user_m68kfp_struct {
  7562. -     unsigned long  fpcntl[3];    /* fp control regs */
  7563.       unsigned long  fpregs[24];    /* fp0-fp7 registers */
  7564.   };
  7565.   
  7566.   /* When the kernel dumps core, it starts by dumping the user struct -
  7567. --- 47,54 ----
  7568.   };
  7569.   
  7570.   struct user_m68kfp_struct {
  7571.       unsigned long  fpregs[24];    /* fp0-fp7 registers */
  7572. +     unsigned long  fpcntl[3];    /* fp control regs */
  7573.   };
  7574.   
  7575.   /* When the kernel dumps core, it starts by dumping the user struct -
  7576. diff -cr --new-file linux-0.9pl1/init/config.c linux-0.9pl2/init/config.c
  7577. *** linux-0.9pl1/init/config.c    Wed Jun 29 16:17:29 1994
  7578. --- linux-0.9pl2/init/config.c    Fri Aug  5 12:47:17 1994
  7579. ***************
  7580. *** 48,53 ****
  7581. --- 48,54 ----
  7582.   unsigned long (*mach_keyb_init) (unsigned long);
  7583.   void (*mach_init_INTS) (void);
  7584.   int (*mach_add_isr) (unsigned long, isrfunc, int, void *);
  7585. + void (*mach_process_int) (int, struct intframe *) = NULL;
  7586.   unsigned long (*mach_gettimeoffset) (void);
  7587.   void (*mach_gettod) (struct mktime*);
  7588.   void (*mach_check_partition) (struct gendisk *, unsigned int);
  7589. diff -cr --new-file linux-0.9pl1/init/main.c linux-0.9pl2/init/main.c
  7590. *** linux-0.9pl1/init/main.c    Tue Jul 26 22:29:09 1994
  7591. --- linux-0.9pl2/init/main.c    Sun Aug 14 09:17:03 1994
  7592. ***************
  7593. *** 102,107 ****
  7594. --- 102,108 ----
  7595.   extern void video_setup(char *str, int *ints);
  7596.   extern void atari_video_setup (char *str, int *ints);
  7597.   extern void wd33c93_setup (char *str, int *ints);
  7598. + extern void gvp11_setup (char *str, int *ints);
  7599.   
  7600.   #ifdef CONFIG_SYSVIPC
  7601.   extern void ipc_init(void);
  7602. ***************
  7603. *** 230,235 ****
  7604. --- 231,239 ----
  7605.           || defined(CONFIG_GVP11_SCSI)
  7606.       { "wd33c93=", wd33c93_setup },
  7607.   #endif
  7608. + #if defined(CONFIG_GVP11_SCSI)
  7609. +     { "gvp11=", gvp11_setup },
  7610. + #endif
  7611.       { 0, 0 }
  7612.   };
  7613.   
  7614. ***************
  7615. *** 329,340 ****
  7616. --- 333,354 ----
  7617.                       break;
  7618.                   }
  7619.               }
  7620. +             continue;
  7621.           } else if (!strcmp(line,"ro"))
  7622. +           {
  7623.               root_mountflags |= MS_RDONLY;
  7624. +             continue;
  7625. +           }
  7626.           else if (!strcmp(line,"rw"))
  7627. +           {
  7628.               root_mountflags &= ~MS_RDONLY;
  7629. +             continue;
  7630. +           }
  7631.           else if (!strcmp(line,"debug"))
  7632. +           {
  7633.               console_loglevel = 10;
  7634. +             continue;
  7635. +           }
  7636.           else if (!strcmp(line,"no387")) {
  7637.               hard_math = 0;
  7638.   #ifdef __i386__
  7639. ***************
  7640. *** 342,349 ****
  7641.                   "orl $0xE,%%eax\n\t"
  7642.                   "movl %%eax,%%cr0\n\t" : : : "ax");
  7643.   #endif
  7644.           } else
  7645. !             checksetup(line);
  7646.           /*
  7647.            * Then check if it's an environment variable or
  7648.            * an option.
  7649. --- 356,365 ----
  7650.                   "orl $0xE,%%eax\n\t"
  7651.                   "movl %%eax,%%cr0\n\t" : : : "ax");
  7652.   #endif
  7653. +             continue;
  7654.           } else
  7655. !             if (!checksetup(line))
  7656. !               continue;
  7657.           /*
  7658.            * Then check if it's an environment variable or
  7659.            * an option.
  7660. diff -cr --new-file linux-0.9pl1/kernel/sched.c linux-0.9pl2/kernel/sched.c
  7661. *** linux-0.9pl1/kernel/sched.c    Sun Jun 26 21:51:32 1994
  7662. --- linux-0.9pl2/kernel/sched.c    Fri Aug  5 12:46:34 1994
  7663. ***************
  7664. *** 108,114 ****
  7665.       } stack_start = { & user_stack [PAGE_SIZE>>2] , KERNEL_DS };
  7666.   
  7667.   struct kernel_stat kstat =
  7668. !     { 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  7669.   
  7670.   /*
  7671.    * int 0x80 entry points.. Moved away from the header file, as
  7672. --- 108,114 ----
  7673.       } stack_start = { & user_stack [PAGE_SIZE>>2] , KERNEL_DS };
  7674.   
  7675.   struct kernel_stat kstat =
  7676. !     { 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, { 0 }, 0, 0, 0, 0, 0, 0 };
  7677.   
  7678.   /*
  7679.    * int 0x80 entry points.. Moved away from the header file, as
  7680. diff -cr --new-file linux-0.9pl1/m68k/head.S linux-0.9pl2/m68k/head.S
  7681. *** linux-0.9pl1/m68k/head.S    Sun Jun 26 15:22:47 1994
  7682. --- linux-0.9pl2/m68k/head.S    Fri Aug  5 12:47:19 1994
  7683. ***************
  7684. *** 6,11 ****
  7685. --- 6,14 ----
  7686.   **
  7687.   ** 68040 fixes by Michael Rausch
  7688.   **
  7689. + ** Atari support by Andreas Schwab, using ideas of Robert de Vries
  7690. + ** and Bjoern Brauel
  7691. + **
  7692.   ** This file is subject to the terms and conditions of the GNU General Public
  7693.   ** License.  See the file README.legal in the main directory of this archive
  7694.   ** for more details.
  7695. ***************
  7696. *** 29,36 ****
  7697.    *   Enable cache memories
  7698.    *   Jump to kernel startup
  7699.    *
  7700. !  * Register d6 contains the CPU flags from the boot_info information
  7701. !  * for most of this file.
  7702.    */
  7703.   
  7704.   .text
  7705. --- 32,39 ----
  7706.    *   Enable cache memories
  7707.    *   Jump to kernel startup
  7708.    *
  7709. !  * Register d6 contains the CPU flags and d4 the machine type
  7710. !  * from the boot_info information for most of this file.
  7711.    */
  7712.   
  7713.   .text
  7714. ***************
  7715. *** 42,47 ****
  7716. --- 45,51 ----
  7717.   BI_MACH = 0
  7718.   BI_AMIGA_ECLK = 1234
  7719.   MACH_AMIGA = 1
  7720. + MACH_ATARI = 2
  7721.   LF   = 10
  7722.   CR   = 13
  7723.   BIT040 = 2
  7724. ***************
  7725. *** 111,120 ****
  7726.       bsr    Lserial_putc
  7727.   
  7728.   /*
  7729. !  * Record the CPU type.
  7730.    */
  7731.       lea    pc@(_boot_info),a0
  7732.       movel    a0@(BI_CPU),d6
  7733.   
  7734.   /*
  7735.    * Get address at end of kernel code/data/bss and
  7736. --- 115,125 ----
  7737.       bsr    Lserial_putc
  7738.   
  7739.   /*
  7740. !  * Record the CPU and machine type.
  7741.    */
  7742.       lea    pc@(_boot_info),a0
  7743.       movel    a0@(BI_CPU),d6
  7744. +     movel    a0@(BI_MACH),d4
  7745.   
  7746.   /*
  7747.    * Get address at end of kernel code/data/bss and
  7748. ***************
  7749. *** 192,198 ****
  7750.       bnes    1f
  7751.   
  7752.       /* 680[23]0 */
  7753. !     lea    pc@(_start),a1  /* base address */
  7754.       addql    #PAGEDESC,a1    /* descriptor type */
  7755.       movel    #0x40000,d2    /* increment */
  7756.       bras    2f
  7757. --- 197,203 ----
  7758.       bnes    1f
  7759.   
  7760.       /* 680[23]0 */
  7761. !     lea    pc@(_start:w),a1  /* base address */
  7762.       addql    #PAGEDESC,a1    /* descriptor type */
  7763.       movel    #0x40000,d2    /* increment */
  7764.       bras    2f
  7765. ***************
  7766. *** 264,272 ****
  7767.   /*
  7768.    * Do any machine specific page table initializations.
  7769.    */
  7770. -     lea    pc@(_boot_info),a0
  7771.       moveq    #MACH_AMIGA,d0
  7772. !     cmpl    a0@(BI_MACH),d0
  7773.       bne    Lnotami
  7774.   
  7775.   /*
  7776. --- 269,276 ----
  7777.   /*
  7778.    * Do any machine specific page table initializations.
  7779.    */
  7780.       moveq    #MACH_AMIGA,d0
  7781. !     cmpl    d4,d0
  7782.       bne    Lnotami
  7783.   
  7784.   /*
  7785. ***************
  7786. *** 352,358 ****
  7787.        * noncachable/serialized.
  7788.        */
  7789.       movel    a3,d0        /* ami page table start address */
  7790. !     lea    pc@(_start),a0
  7791.       subl    a0,d0        /* determine offset of root table page */
  7792.       moveq    #12,d1        /* determine offset into kernel page table */
  7793.       lsrl    d1,d0
  7794. --- 356,362 ----
  7795.        * noncachable/serialized.
  7796.        */
  7797.       movel    a3,d0        /* ami page table start address */
  7798. !     lea    pc@(_start:w),a0
  7799.       subl    a0,d0        /* determine offset of root table page */
  7800.       moveq    #12,d1        /* determine offset into kernel page table */
  7801.       lsrl    d1,d0
  7802. ***************
  7803. *** 371,376 ****
  7804. --- 375,432 ----
  7805.   
  7806.   Lnotami:    /* other machines specific mappings go here! */
  7807.   
  7808. +     moveq    #MACH_ATARI,d0
  7809. +     cmpl    d4,d0
  7810. +     bne    Lnotatari
  7811. + /* On the Atari, duplicate the i/o region at 0xffffxxxxx and
  7812. +    mark it non-cachable, set up an identity translation of the first
  7813. +    16M.  We need two additional page tables for this */
  7814. +     lea    a5@(1024),a0
  7815. +     addl    #2,a0
  7816. +     movel    a0,a5@(508)        /* 0xFE000000 - 0xFFFFFFFF */
  7817. +     lea     a5@(1024),a0
  7818. +     movel    #0,d0
  7819. +     movel    #63,d2
  7820. + 1:    movel    d0,a0@+
  7821. +     dbra    d2,1b
  7822. + /* Identity mapping of the last 16M of virtual address space
  7823. +    to the first 16M for efficient addressing of hardware registers */
  7824. +     movel    #0x40000,d1
  7825. +     movel    #63,d2
  7826. +     movel    #PAGEDESC,d0
  7827. + 1:    movel    d0,a0@+
  7828. +     addl    d1,d0
  7829. +     dbra    d2,1b
  7830. +     moveq    #0x40,d0    /* make non-cachable */
  7831. +     addl    d0,a5@(1532)    /* 0xFFFC0000-0xFFFFFFFF (I/O space) */
  7832. +     lea    a5@(1536+TABLEDESC),a0
  7833. +     movel    a0,a5@
  7834. + /* Identity mapping of the first 16M of virtual address space */
  7835. +     lea    a5@(1536),a0
  7836. +     movel    #PAGEDESC,d0
  7837. +     movel    #0x40000,d1
  7838. +     movel    #63,d2
  7839. + 1:    movel    d0,a0@+
  7840. +     addl    d1,d0
  7841. +     dbra    d2,1b
  7842. + /* 0x00FC0000 - 0x00FFFFFF (I/O space) uncachable */
  7843. +     movel    #0x40,d0
  7844. +     addl    d0,a0@(-4)
  7845. +     movel    #0,d0
  7846. +     movel    #63,d2
  7847. + 1:    movel    d0,a0@+
  7848. +     dbra    d2,1b
  7849. +     bra    Lmapphys
  7850. + Lnotatari:
  7851.   /*
  7852.    * Setup a transparent mapping of the physical memory we are executing in.
  7853.    *
  7854. ***************
  7855. *** 383,390 ****
  7856.   
  7857.       clrl    d5        /* indicate that no cleanup is required */
  7858.   
  7859. !     lea    pc@(_boot_info),a0
  7860. !     cmpl    #MACH_AMIGA,a0@(BI_MACH)
  7861.       bnes    Lnophys     /* other machines will probably have
  7862.                    * to put in code and jump to it here
  7863.                    */
  7864. --- 439,445 ----
  7865.   
  7866.       clrl    d5        /* indicate that no cleanup is required */
  7867.   
  7868. !     cmpl    #MACH_AMIGA,d4
  7869.       bnes    Lnophys     /* other machines will probably have
  7870.                    * to put in code and jump to it here
  7871.                    */
  7872. ***************
  7873. *** 403,409 ****
  7874.                    */
  7875.   
  7876.   2:
  7877. !     lea    pc@(_start),a0  /* get address of start of memory */
  7878.       cmpl    a0,d0        /* compare limit to start */
  7879.       bhi    Lnophys
  7880.   
  7881. --- 458,464 ----
  7882.                    */
  7883.   
  7884.   2:
  7885. !     lea    pc@(_start:w),a0  /* get address of start of memory */
  7886.       cmpl    a0,d0        /* compare limit to start */
  7887.       bhi    Lnophys
  7888.   
  7889. ***************
  7890. *** 419,425 ****
  7891.        * in the root table.  a0 contains the start address of the
  7892.        * kernel.
  7893.        */
  7894. !     lea    pc@(_start),a0
  7895.       movel    a0,d2
  7896.       moveq    #25,d3        /* find appropriate index in root table */
  7897.       lsrl    d3,d2
  7898. --- 474,480 ----
  7899.        * in the root table.  a0 contains the start address of the
  7900.        * kernel.
  7901.        */
  7902. !     lea    pc@(_start:w),a0
  7903.       movel    a0,d2
  7904.       moveq    #25,d3        /* find appropriate index in root table */
  7905.       lsrl    d3,d2
  7906. ***************
  7907. *** 434,440 ****
  7908.        * registers to identity map the 16M chunk that contains
  7909.        * the physical memory.
  7910.        */
  7911. !     lea    pc@(_start),a0
  7912.       movel    a0,d2
  7913.       andl    #0xff000000,d2        /* logical address base */
  7914.       orw    #0xc040,d2        /* add in magic bits */
  7915. --- 489,495 ----
  7916.        * registers to identity map the 16M chunk that contains
  7917.        * the physical memory.
  7918.        */
  7919. !     lea    pc@(_start:w),a0
  7920.       movel    a0,d2
  7921.       andl    #0xff000000,d2        /* logical address base */
  7922.       orw    #0xc040,d2        /* add in magic bits */
  7923. ***************
  7924. *** 442,447 ****
  7925. --- 497,532 ----
  7926.       .long    0x4e7b2006        /* movec d2,dttr0 */
  7927.   
  7928.   Lnophys:
  7929. +     cmpl    #MACH_ATARI,d4
  7930. +     bnes    Lnophys2
  7931. +     /* if kernel runs in tt-ram, identity map its address space,
  7932. +        to be removed later */
  7933. +     lea    pc@(_start:w),a1
  7934. +     cmpl    #0x1000000,a1
  7935. +     bcs    Lnophys2
  7936. +     /* cleanup is needed; note it */
  7937. +     moveq    #1,d5
  7938. +     /* this assumes that the kernel is in the first 12M of tt-ram,
  7939. +        otherwise we would have to set up an additional pointer table */
  7940. +     movel    a1,d2
  7941. +     moveq    #18,d3        /* find appropriate index in pointer table */
  7942. +     lsrl    d3,d2
  7943. +     movel    d2,d0
  7944. +     lsll    d3,d0        /* convert address into descriptor */
  7945. +     addql    #PAGEDESC,d0
  7946. +     movel    #1<<18,d1
  7947. +     lea    a5@(1536),a0
  7948. +     lea    a0@(d2:l:4),a0
  7949. +     moveq    #15,d2
  7950. + 1:    movel    d0,a0@+        /* store mapping */
  7951. +     addl    d1,d0
  7952. +     dbra    d2,1b
  7953. + Lnophys2:
  7954.   
  7955.   /*
  7956.    * Setup Supervisor Root Pointer register to point to page directory,
  7957. ***************
  7958. *** 488,494 ****
  7959.       bsr    Lserial_putc
  7960.   
  7961.       movel    #KSTART_ADDR,d0
  7962. !     lea    pc@(_start),a0
  7963.   
  7964.       movel    _kpt,d1
  7965.       subl    a0,d1
  7966. --- 573,579 ----
  7967.       bsr    Lserial_putc
  7968.   
  7969.       movel    #KSTART_ADDR,d0
  7970. !     lea    pc@(_start:w),a0
  7971.   
  7972.       movel    _kpt,d1
  7973.       subl    a0,d1
  7974. ***************
  7975. *** 520,527 ****
  7976.        lea       pc@(tmp_fault_handler),a0
  7977.        move.l    a0,8                     /* Access fault vector */
  7978.   
  7979. !     lea    pc@(_start),a0
  7980. !     jmp    Lvirt
  7981.   
  7982.   Lvirt:
  7983.       moveq    #'N',d7
  7984. --- 605,612 ----
  7985.        lea       pc@(tmp_fault_handler),a0
  7986.        move.l    a0,8                     /* Access fault vector */
  7987.   
  7988. !     lea    pc@(_start:w),a0
  7989. !     jmp    Lvirt:l
  7990.   
  7991.   Lvirt:
  7992.       moveq    #'N',d7
  7993. ***************
  7994. *** 538,548 ****
  7995. --- 623,652 ----
  7996.       bnes    Loff040
  7997.   
  7998.       /* clean up physical identity mapping for 68020/68030 */
  7999. +     cmpl    #MACH_AMIGA,d4
  8000. +     bne    Lnoamiclean
  8001.       movel    a0,d2        /* a0 contains physical start address */
  8002.       moveq    #25,d3        /* find appropriate index in root table */
  8003.       lsrl    d3,d2
  8004.       moveq    #0,d0
  8005.       movel    d0,a5@(d2:l:4)  /* clear descriptor */
  8006. + Lnoamiclean:
  8007. +     cmpl    #MACH_ATARI,d4
  8008. +     bne    Lnoclean
  8009. +     movel    a0,d2        /* a0 contains physical start address */
  8010. +     moveq    #18,d3        /* find appropriate index in pointer table */
  8011. +     lsrl    d3,d2
  8012. +     moveq    #0,d0
  8013. +     lea    a5@(1536),a1
  8014. +     lea    a1@(d2:l:4),a1
  8015. +     moveq    #15,d5
  8016. + 1:    movel    d0,a1@+        /* clear descriptor */
  8017. +     dbra    d5,1b
  8018.       pflusha         /* flush address translation cache */
  8019.       bras    Lnoclean
  8020.   
  8021. ***************
  8022. *** 633,662 ****
  8023.   LSERIAL_CNTRL = 0xbfd000
  8024.   LSERIAL_DTR   = 7
  8025.   
  8026.   
  8027.   /*
  8028.    * Initialize serial port hardware for 9600/8/1
  8029.    */
  8030.        .even
  8031.   Lserial_init:
  8032. !     lea    pc@(_boot_info),a0
  8033. !     cmpil    #MACH_AMIGA,a0@(BI_MACH)
  8034.       bnes    1f
  8035.       bclr    #LSERIAL_DTR,LSERIAL_CNTRL
  8036.       movew    #LNTSC_PERIOD,LSERPER
  8037.       cmpl    #LNTSC_ECLOCK,a0@(BI_AMIGA_ECLK)
  8038. !     beqs    1f
  8039.       movew    #LPAL_PERIOD,LSERPER
  8040. ! 1:    rts
  8041.   
  8042.   /*
  8043.    * Output character in d7 on serial port.
  8044. !  * d7 unchanged.
  8045.    */
  8046.   Lserial_putc:
  8047.       movel    a0,sp@-
  8048. !     lea    pc@(_boot_info),a0
  8049. !     cmpil    #MACH_AMIGA,a0@(BI_MACH)
  8050.       bnes    2f
  8051.       andw    #0x00ff,d7
  8052.       oriw    #0x0100,d7
  8053. --- 737,850 ----
  8054.   LSERIAL_CNTRL = 0xbfd000
  8055.   LSERIAL_DTR   = 7
  8056.   
  8057. + /*
  8058. +  * Debug output support
  8059. +  * Atarians have a choice between the parallel port, the serial port
  8060. +  * from the MFP or a serial port of the SCC
  8061. +  */
  8062. + /* #define USE_PRINTER */
  8063. + /* #define USE_SCC */
  8064. + #define USE_MFP
  8065. + #ifdef USE_PRINTER
  8066. + LPSG_SELECT    = 0xff8800
  8067. + LPSG_READ    = 0xff8800
  8068. + LPSG_WRITE    = 0xff8802
  8069. + LPSG_IO_A    = 14
  8070. + LPSG_IO_B    = 15
  8071. + LPSG_CONTROL    = 7
  8072. + LSTMFP_GPIP    = 0xfffa01
  8073. + LSTMFP_DDR    = 0xfffa05
  8074. + LSTMFP_IERB    = 0xfffa09
  8075. + #elif defined(USE_SCC)
  8076. +  
  8077. + LSCC_CTRL_B    = 0xff8c85
  8078. + LSCC_DATA_B    = 0xff8c87
  8079. + /* Initialisation table for SCC */
  8080. + scc_initable:
  8081. +     .byte    9,12        /* Reset */
  8082. +     .byte    4,0x44        /* x16, 1 stopbit, no parity */
  8083. +     .byte    3,0xc0        /* receiver: 8 bpc */
  8084. +     .byte    5,0xe2        /* transmitter: 8 bpc, assert dtr/rts */
  8085. +     .byte    9,0        /* no interrupts */
  8086. +     .byte    10,0        /* NRZ */
  8087. +     .byte    11,0x50        /* use baud rate generator */
  8088. +     .byte    12,24,13,0    /* 9600 baud */
  8089. +     .byte    14,2,14,3    /* use master clock for BRG, enable */
  8090. +     .byte    3,0xc1        /* enable receiver */
  8091. +     .byte    5,0xea        /* enable transmitter */
  8092. +     .byte    -1
  8093. +     .even
  8094. + #elif defined(USE_MFP)
  8095. + LMFP_UCR     = 0xfffa29
  8096. + LMFP_TDCDR   = 0xfffa1d
  8097. + LMFP_TDDR    = 0xfffa25
  8098. + LMFP_TSR     = 0xfffa2d
  8099. + LMFP_UDR     = 0xfffa2f
  8100. + #endif
  8101.   
  8102.   /*
  8103.    * Initialize serial port hardware for 9600/8/1
  8104. +  * a0 thrashed
  8105. +  * Atari d0 trashed (a1 in case of SCC)
  8106.    */
  8107.        .even
  8108.   Lserial_init:
  8109. !     cmpil    #MACH_AMIGA,d4
  8110.       bnes    1f
  8111.       bclr    #LSERIAL_DTR,LSERIAL_CNTRL
  8112.       movew    #LNTSC_PERIOD,LSERPER
  8113.       cmpl    #LNTSC_ECLOCK,a0@(BI_AMIGA_ECLK)
  8114. !     beqs    9f
  8115.       movew    #LPAL_PERIOD,LSERPER
  8116. !     bra    9f
  8117. ! 1:    cmpil   #MACH_ATARI,d4
  8118. !     bne    9f
  8119. ! #ifdef USE_PRINTER
  8120. !     bclr    #0,LSTMFP_IERB
  8121. !     bclr    #0,LSTMFP_DDR
  8122. !     moveb    #LPSG_CONTROL,LPSG_SELECT
  8123. !     moveb    #0xff,LPSG_WRITE
  8124. !     moveb    #LPSG_IO_B,LPSG_SELECT
  8125. !     clrb    LPSG_WRITE
  8126. !     moveb    #LPSG_IO_A,LPSG_SELECT
  8127. !     moveb    LPSG_READ,d0
  8128. !     bset    #5,d0
  8129. !     moveb    d0,LPSG_WRITE
  8130. ! #elif defined(USE_SCC)
  8131. !     lea    LSCC_CTRL_B,a0
  8132. !     lea    pc@(scc_initable:w),a1
  8133. ! 2:    moveb    a1@+,d0
  8134. !     jmi    3f
  8135. !     moveb    d0,a0@
  8136. !     moveb    a1@+,a0@
  8137. !     jra    2b
  8138. ! 3:    clrb    a0@
  8139. ! #elif defined(USE_MFP)
  8140. !     bclr    #1,LMFP_TSR
  8141. !     moveb   #0x88,LMFP_UCR
  8142. !     andb    #0x70,LMFP_TDCDR
  8143. !     moveb   #2,LMFP_TDDR
  8144. !     orb    #1,LMFP_TDCDR
  8145. !     bset    #1,LMFP_TSR
  8146. ! #endif
  8147. ! 9:
  8148. !     rts
  8149.   
  8150.   /*
  8151.    * Output character in d7 on serial port.
  8152. !  * d7 thrashed.
  8153.    */
  8154.   Lserial_putc:
  8155.       movel    a0,sp@-
  8156. !     cmpil    #MACH_AMIGA,d4
  8157.       bnes    2f
  8158.       andw    #0x00ff,d7
  8159.       oriw    #0x0100,d7
  8160. ***************
  8161. *** 664,670 ****
  8162.   1:    movew    LSERDATR,d7
  8163.       andw    #0x2000,d7
  8164.       beq    1b
  8165. ! 2:    movel    sp@+,a0
  8166.       rts
  8167.   
  8168.   /*
  8169. --- 852,884 ----
  8170.   1:    movew    LSERDATR,d7
  8171.       andw    #0x2000,d7
  8172.       beq    1b
  8173. !     bra    9f
  8174. ! 2:    cmpil   #MACH_ATARI,d4
  8175. !     jne    9f
  8176. ! #ifdef USE_PRINTER
  8177. ! 3:    btst    #0,LSTMFP_GPIP
  8178. !     jne    3b
  8179. !     moveb    #LPSG_IO_B,LPSG_SELECT
  8180. !     moveb    d7,LPSG_WRITE
  8181. !     moveb    #LPSG_IO_A,LPSG_SELECT
  8182. !     moveb    LPSG_READ,d7
  8183. !     bclr    #5,d7
  8184. !     moveb    d7,LPSG_WRITE
  8185. !     nop
  8186. !     nop
  8187. !     bset    #5,d7
  8188. !     moveb    d7,LPSG_WRITE
  8189. ! #elif defined(USE_SCC)
  8190. ! 3:    btst    #2,LSCC_CTRL_B
  8191. !     jeq    3b
  8192. !     moveb    d7,LSCC_DATA_B
  8193. ! #elif defined(USE_MFP)
  8194. ! 3:    btst    #7,LMFP_TSR
  8195. !     jeq    3b
  8196. !     moveb    d7,LMFP_UDR
  8197. ! #endif
  8198. ! 9:
  8199. !     movel    sp@+,a0
  8200.       rts
  8201.   
  8202.   /*
  8203. ***************
  8204. *** 698,716 ****
  8205.       addb    #'0',d7
  8206.       bras    2f
  8207.   1:    addb    #'A'-10,d7
  8208. ! 2:    bsrs    Lserial_putc
  8209.       dbra    d2,L1
  8210.       moveq    #32,d7
  8211. !     bsrs    Lserial_putc
  8212.       moveml    sp@+,d0-d2/d7
  8213.       rts
  8214.   .globl showtest
  8215.   showtest:
  8216.       moveml    a1/d7,sp@-
  8217.       moveq    #'A',d7
  8218. !     bsrs    Lserial_putc
  8219.       moveq    #'=',d7
  8220. !     bsrs    Lserial_putc
  8221.       movel    a0,d7
  8222.       bsrs    Lserial_putnum
  8223.   
  8224. --- 912,930 ----
  8225.       addb    #'0',d7
  8226.       bras    2f
  8227.   1:    addb    #'A'-10,d7
  8228. ! 2:    bsr    Lserial_putc
  8229.       dbra    d2,L1
  8230.       moveq    #32,d7
  8231. !     bsr    Lserial_putc
  8232.       moveml    sp@+,d0-d2/d7
  8233.       rts
  8234.   .globl showtest
  8235.   showtest:
  8236.       moveml    a1/d7,sp@-
  8237.       moveq    #'A',d7
  8238. !     bsr    Lserial_putc
  8239.       moveq    #'=',d7
  8240. !     bsr    Lserial_putc
  8241.       movel    a0,d7
  8242.       bsrs    Lserial_putnum
  8243.   
  8244. diff -cr --new-file linux-0.9pl1/m68k/ints.c linux-0.9pl2/m68k/ints.c
  8245. *** linux-0.9pl1/m68k/ints.c    Sun Jun 26 15:30:24 1994
  8246. --- linux-0.9pl2/m68k/ints.c    Fri Aug  5 12:47:20 1994
  8247. ***************
  8248. *** 13,27 ****
  8249.   #include <linux/interrupt.h>
  8250.   #include <linux/sched.h>
  8251.   
  8252. - /*
  8253. -  * ++roman: The number of possible interrupts is 7 only if there are no
  8254. -  * non-autovec ints. But e.g. the Atari uses a lot of them. So I defined
  8255. -  * a constant NUM_INT_SOURCES in interrupt.h that gives the total number of
  8256. -  * possible interrputs. A constant FIRST_NONAUTO_VEC is defined also.
  8257. -  */
  8258.   /* list is accessed 0-6 for IRQs 1-7 */
  8259. ! static isr_node_t *isr_list[NUM_INT_SOURCES];
  8260.   
  8261.   /* The number of spurious interrupts */
  8262.   volatile unsigned long num_spurious;
  8263. --- 13,20 ----
  8264.   #include <linux/interrupt.h>
  8265.   #include <linux/sched.h>
  8266.   
  8267.   /* list is accessed 0-6 for IRQs 1-7 */
  8268. ! static isr_node_t *isr_list[7];
  8269.   
  8270.   /* The number of spurious interrupts */
  8271.   volatile unsigned long num_spurious;
  8272. ***************
  8273. *** 47,53 ****
  8274.       int i;
  8275.   
  8276.       /* initialize the ISR list pointers */
  8277. !     for (i = 0; i < NUM_INT_SOURCES; i++)
  8278.       isr_list[i] = NULL;
  8279.   
  8280.       num_spurious = 0;
  8281. --- 40,46 ----
  8282.       int i;
  8283.   
  8284.       /* initialize the ISR list pointers */
  8285. !     for (i = 0; i < 7; i++)
  8286.       isr_list[i] = NULL;
  8287.   
  8288.       num_spurious = 0;
  8289. ***************
  8290. *** 133,139 ****
  8291.   {
  8292.       isr_node_t *np;
  8293.   
  8294. !     static isr_node_t nodes[32];
  8295.       static int curnode = 0;
  8296.   
  8297.       np = &nodes[curnode++];
  8298. --- 126,132 ----
  8299.   {
  8300.       isr_node_t *np;
  8301.   
  8302. !     static isr_node_t nodes[100];
  8303.       static int curnode = 0;
  8304.   
  8305.       np = &nodes[curnode++];
  8306. ***************
  8307. *** 152,158 ****
  8308.       return mach_add_isr (source, isr, pri, data);
  8309.       }
  8310.   
  8311. !     if (source < IRQ1 || source > NUM_INT_SOURCES)
  8312.       panic ("add_isr: Incorrect IRQ source");
  8313.   
  8314.       p = new_isr_node();
  8315. --- 145,151 ----
  8316.       return mach_add_isr (source, isr, pri, data);
  8317.       }
  8318.   
  8319. !     if (source < IRQ1 || source > IRQ7)
  8320.       panic ("add_isr: Incorrect IRQ source");
  8321.   
  8322.       p = new_isr_node();
  8323. ***************
  8324. *** 183,199 ****
  8325.       static int last_spur = 0;
  8326.   #endif
  8327.         
  8328. - #if NUM_INT_SOURCES > 7
  8329. -   /* Possibility for non-autovec ints! */
  8330. -   if (level < 8)
  8331. -       /* autovector int */
  8332. -       call_isr_list (isr_list[level-1], fp);
  8333. -   else
  8334. -       /* non-autovec */
  8335. -       call_isr_list (isr_list[level-FIRST_NONAUTO_VEC+24+7], fp);
  8336. - #else
  8337.     call_isr_list (isr_list[level-1], fp);
  8338. - #endif
  8339.   
  8340.   #ifdef DEBUG_LOST_INT_DECR
  8341.       if (cnt != intr_count) {
  8342. --- 176,182 ----
  8343. diff -cr --new-file linux-0.9pl1/m68k/ptrace.c linux-0.9pl2/m68k/ptrace.c
  8344. *** linux-0.9pl1/m68k/ptrace.c    Tue Jun  7 19:38:44 1994
  8345. --- linux-0.9pl2/m68k/ptrace.c    Fri Aug  5 12:46:34 1994
  8346. ***************
  8347. *** 17,22 ****
  8348. --- 17,24 ----
  8349.   #include <linux/ptrace.h>
  8350.   #include <linux/errno.h>
  8351.   #include <linux/bootinfo.h>
  8352. + #include <linux/user.h>
  8353. + #include <linux/stddef.h>
  8354.   
  8355.   /*
  8356.    * This routine gets a long from any process space by following the page
  8357. ***************
  8358. *** 123,132 ****
  8359.       if (addr > TASK_SIZE-sizeof(long))
  8360.           return -EIO;
  8361.       if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) {
  8362. !         low = get_long(tsk,addr & ~(sizeof(long)-1));
  8363. !         high = get_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1));
  8364.           switch (addr & (sizeof(long)-1)) {
  8365. !             case 1:
  8366.                   low >>= 8;
  8367.                   low |= high << 24;
  8368.                   break;
  8369. --- 125,134 ----
  8370.       if (addr > TASK_SIZE-sizeof(long))
  8371.           return -EIO;
  8372.       if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) {
  8373. !         high = get_long(tsk,addr & ~(sizeof(long)-1));
  8374. !         low = get_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1));
  8375.           switch (addr & (sizeof(long)-1)) {
  8376. !             case 3:
  8377.                   low >>= 8;
  8378.                   low |= high << 24;
  8379.                   break;
  8380. ***************
  8381. *** 134,140 ****
  8382.                   low >>= 16;
  8383.                   low |= high << 16;
  8384.                   break;
  8385. !             case 3:
  8386.                   low >>= 24;
  8387.                   low |= high << 8;
  8388.                   break;
  8389. --- 136,142 ----
  8390.                   low >>= 16;
  8391.                   low |= high << 16;
  8392.                   break;
  8393. !             case 1:
  8394.                   low >>= 24;
  8395.                   low |= high << 8;
  8396.                   break;
  8397. ***************
  8398. *** 156,168 ****
  8399.       if (addr > TASK_SIZE-sizeof(long))
  8400.           return -EIO;
  8401.       if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) {
  8402. !         low = get_long(tsk,addr & ~(sizeof(long)-1));
  8403. !         high = get_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1));
  8404.           switch (addr & (sizeof(long)-1)) {
  8405.               case 0: /* shouldn't happen, but safety first */
  8406. !                 low = data;
  8407.                   break;
  8408. !             case 1:
  8409.                   low &= 0x000000ff;
  8410.                   low |= data << 8;
  8411.                   high &= ~0xff;
  8412. --- 158,170 ----
  8413.       if (addr > TASK_SIZE-sizeof(long))
  8414.           return -EIO;
  8415.       if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) {
  8416. !         high = get_long(tsk,addr & ~(sizeof(long)-1));
  8417. !         low = get_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1));
  8418.           switch (addr & (sizeof(long)-1)) {
  8419.               case 0: /* shouldn't happen, but safety first */
  8420. !                 high = data;
  8421.                   break;
  8422. !             case 3:
  8423.                   low &= 0x000000ff;
  8424.                   low |= data << 8;
  8425.                   high &= ~0xff;
  8426. ***************
  8427. *** 174,188 ****
  8428.                   high &= ~0xffff;
  8429.                   high |= data >> 16;
  8430.                   break;
  8431. !             case 3:
  8432.                   low &= 0x00ffffff;
  8433.                   low |= data << 24;
  8434.                   high &= ~0xffffff;
  8435.                   high |= data >> 8;
  8436.                   break;
  8437.           }
  8438. !         put_long(tsk,addr & ~(sizeof(long)-1),low);
  8439. !         put_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1),high);
  8440.       } else
  8441.           put_long(tsk,addr,data);
  8442.       return 0;
  8443. --- 176,190 ----
  8444.                   high &= ~0xffff;
  8445.                   high |= data >> 16;
  8446.                   break;
  8447. !             case 1:
  8448.                   low &= 0x00ffffff;
  8449.                   low |= data << 24;
  8450.                   high &= ~0xffffff;
  8451.                   high |= data >> 8;
  8452.                   break;
  8453.           }
  8454. !         put_long(tsk,addr & ~(sizeof(long)-1),high);
  8455. !         put_long(tsk,(addr+sizeof(long)) & ~(sizeof(long)-1),low);
  8456.       } else
  8457.           put_long(tsk,addr,data);
  8458.       return 0;
  8459. ***************
  8460. *** 193,199 ****
  8461.       unsigned long tmp;
  8462.       int res;
  8463.   
  8464. !     if ((addr & 3) || addr < 0 || addr > 18*sizeof(long))
  8465.           return -EIO;
  8466.   
  8467.       res = verify_area(VERIFY_WRITE, (void *) data, sizeof(long));
  8468. --- 195,201 ----
  8469.       unsigned long tmp;
  8470.       int res;
  8471.   
  8472. !     if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
  8473.           return -EIO;
  8474.   
  8475.       res = verify_area(VERIFY_WRITE, (void *) data, sizeof(long));
  8476. ***************
  8477. *** 206,218 ****
  8478.           if (addr == PT_SR)
  8479.               tmp &= 0xffff;
  8480.       }
  8481.       put_fs_long(tmp,(unsigned long *) data);
  8482.       return 0;
  8483.   }
  8484.   
  8485.   int ptrace_pokeusr(struct task_struct *tsk, long addr, long data)
  8486.   {
  8487. !     if ((addr & 3) || addr < 0 || addr > 18*sizeof(long))
  8488.           return -EIO;
  8489.   
  8490.       addr = addr >> 2; /* temporary hack. */
  8491. --- 208,230 ----
  8492.           if (addr == PT_SR)
  8493.               tmp &= 0xffff;
  8494.       }
  8495. +     else if (addr >= offsetof (struct user, m68kfp)
  8496. +          && addr < (offsetof (struct user, m68kfp)
  8497. +                 + sizeof (struct user_m68kfp_struct)))
  8498. +       {
  8499. +         addr -= offsetof (struct user, m68kfp);
  8500. +         addr >>= 2;
  8501. +         tmp = tsk->tss.fpregs[addr];
  8502. +       }
  8503. +     else
  8504. +       return -EIO;
  8505.       put_fs_long(tmp,(unsigned long *) data);
  8506.       return 0;
  8507.   }
  8508.   
  8509.   int ptrace_pokeusr(struct task_struct *tsk, long addr, long data)
  8510.   {
  8511. !     if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
  8512.           return -EIO;
  8513.   
  8514.       addr = addr >> 2; /* temporary hack. */
  8515. ***************
  8516. *** 223,234 ****
  8517.           data &= SR_MASK;
  8518.           data |= ptrace_get_stack_long(tsk, PT_SR*sizeof(long)) & ~SR_MASK;
  8519.       }
  8520. -     /* Do not allow the user to set the debug register for kernel
  8521. -        address space */
  8522.       if(addr < 19){
  8523.           if (ptrace_put_stack_long(tsk, sizeof(long)*addr, data))
  8524.               return -EIO;
  8525.           return 0;
  8526.       };
  8527.       return -EIO;
  8528.   }
  8529. --- 235,252 ----
  8530.           data &= SR_MASK;
  8531.           data |= ptrace_get_stack_long(tsk, PT_SR*sizeof(long)) & ~SR_MASK;
  8532.       }
  8533.       if(addr < 19){
  8534.           if (ptrace_put_stack_long(tsk, sizeof(long)*addr, data))
  8535.               return -EIO;
  8536.           return 0;
  8537.       };
  8538. +     if (addr >= offsetof (struct user, m68kfp) >> 2
  8539. +         && addr < (offsetof (struct user, m68kfp)
  8540. +                + sizeof (struct user_m68kfp_struct)) >> 2)
  8541. +       {
  8542. +         addr -= offsetof (struct user, m68kfp) >> 2;
  8543. +         tsk->tss.fpregs[addr] = data;
  8544. +         return 0;
  8545. +       }
  8546.       return -EIO;
  8547.   }
  8548. diff -cr --new-file linux-0.9pl1/m68k/sys_call.S linux-0.9pl2/m68k/sys_call.S
  8549. *** linux-0.9pl1/m68k/sys_call.S    Sun Jun 26 15:32:26 1994
  8550. --- linux-0.9pl2/m68k/sys_call.S    Fri Aug  5 12:47:20 1994
  8551. ***************
  8552. *** 156,162 ****
  8553.       movel    sp,a0@(LESP0_OFFSET)
  8554.   
  8555.       cmpl    _NR_syscalls,d0
  8556. !     bgt    _ret_from_exception
  8557.       andw    #~LCF_MASK,sp@(LOFF_SR) | assume syscall success
  8558.       clrl    a0@(LTS_ERRNO)
  8559.       btst    #5,a0@(LTS_FLAGS+3)     | PF_TRACESYS
  8560. --- 156,162 ----
  8561.       movel    sp,a0@(LESP0_OFFSET)
  8562.   
  8563.       cmpl    _NR_syscalls,d0
  8564. !     bhi    _ret_from_exception
  8565.       andw    #~LCF_MASK,sp@(LOFF_SR) | assume syscall success
  8566.       clrl    a0@(LTS_ERRNO)
  8567.       btst    #5,a0@(LTS_FLAGS+3)     | PF_TRACESYS
  8568. ***************
  8569. *** 238,243 ****
  8570. --- 238,244 ----
  8571.   
  8572.   /*
  8573.   ** This is the main interrupt handler, responsible for calling process_int()
  8574. + ** or (*mach_process_int)(), if it is a non-autovector int.
  8575.   */
  8576.   _inthandler:
  8577.       moveml    a0-a1/d0-d1,sp@-    |  save registers
  8578. ***************
  8579. *** 246,268 ****
  8580.       movew    sp@(22),d0              |  put exception # in d0
  8581.       andil    #0xfff,d0        |  mask out format nybble
  8582.   
  8583. !     subil    #0x60,d0        |  convert from vector offset...
  8584.       lsrl    #2,d0            |  ...to IRQ number
  8585.   
  8586.       beq    Lspurious        |  if zero, spurious interrupt
  8587. ! | the following two lines were replaced by the one after for the Atari
  8588. ! |    movec    msp,a0            |  push interrupt stack frame address
  8589. ! |    movel    a0,sp@-
  8590. !     pea    sp@            |  push interrupt stack frame address
  8591.       movel    d0,sp@-         |  put IRQ # on stack
  8592.       jbsr    _process_int        |  process the IRQ
  8593.       addql    #8,sp            |  pop parameters off stack
  8594.   
  8595. !     subql    #1,_intr_count
  8596.   
  8597.   
  8598.       /* maybe process software interrupts */
  8599. !     tstl    _intr_count
  8600.       bne    1f
  8601.   
  8602.       movel    _bh_mask,d0
  8603. --- 247,283 ----
  8604.       movew    sp@(22),d0              |  put exception # in d0
  8605.       andil    #0xfff,d0        |  mask out format nybble
  8606.   
  8607. !     cmpw    #0x100,d0        |  check if user interrupt
  8608. !     bge    Luserint
  8609. !     subiw    #0x60,d0        |  convert from vector offset...
  8610.       lsrl    #2,d0            |  ...to IRQ number
  8611.   
  8612.       beq    Lspurious        |  if zero, spurious interrupt
  8613. !     movec    msp,a0            |  push interrupt stack frame address
  8614. !     movel    a0,sp@-
  8615.       movel    d0,sp@-         |  put IRQ # on stack
  8616.       jbsr    _process_int        |  process the IRQ
  8617.       addql    #8,sp            |  pop parameters off stack
  8618. +     jra     1f
  8619. + Luserint:
  8620. +     movel    _mach_process_int,a1
  8621. +     tstl    a1            | if no hook installed
  8622. +     beq    Lspurious        | ... then spurious interrupt
  8623. +     subiw    #0x100,d0        | convert from vector offset...
  8624. +     lsrl    #2,d0            | ...to IRQ number
  8625. +     movec    msp,a0            |  push interrupt stack frame address
  8626. +     movel    a0,sp@-
  8627. +     movel    d0,sp@-            | put IRQ # on stack
  8628. +     jsr    a1@            | process the IRQ
  8629. +     addql    #8,sp            | pop parameters off stack
  8630.   
  8631. ! 1:
  8632.   
  8633.   
  8634.       /* maybe process software interrupts */
  8635. !     subql    #1,_intr_count
  8636.       bne    1f
  8637.   
  8638.       movel    _bh_mask,d0
  8639. diff -cr --new-file linux-0.9pl1/m68k/traps.c linux-0.9pl2/m68k/traps.c
  8640. *** linux-0.9pl1/m68k/traps.c    Thu Jul  7 19:23:54 1994
  8641. --- linux-0.9pl2/m68k/traps.c    Fri Aug  5 12:46:35 1994
  8642. ***************
  8643. *** 579,586 ****
  8644.       printk("PC:    %08lx\nSR: %04x\n", fp->pc,fp->sr);
  8645.       if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
  8646.           printk("Corrupted stack page\n");
  8647. !     printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)\nStack: ",
  8648. !         current->comm, current->pid, 0xffff & i, current->kernel_stack_page);
  8649.       for (i = 0; i < 10; i++)
  8650.           printk ("%02x ", 0xff & ssp[i]);
  8651.       printk ("\n");
  8652. --- 579,586 ----
  8653.       printk("PC:    %08lx\nSR: %04x\n", fp->pc,fp->sr);
  8654.       if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
  8655.           printk("Corrupted stack page\n");
  8656. !     printk("Process %s (pid: %d, stackpage=%08lx)\nStack: ",
  8657. !         current->comm, current->pid, current->kernel_stack_page);
  8658.       for (i = 0; i < 10; i++)
  8659.           printk ("%02x ", 0xff & ssp[i]);
  8660.       printk ("\n");
  8661. diff -cr --new-file linux-0.9pl1/mm/memory.c linux-0.9pl2/mm/memory.c
  8662. *** linux-0.9pl1/mm/memory.c    Sat Jun 25 18:52:56 1994
  8663. --- linux-0.9pl2/mm/memory.c    Fri Aug  5 12:46:37 1994
  8664. ***************
  8665. *** 557,563 ****
  8666.                   free_pointer_table (ptrp);
  8667.               else if (!ptrp)
  8668.                   return -ENOMEM;
  8669. !             *rootp = VTOP(ptrp) | PAGE_TABLE;
  8670.           }
  8671.           ptrp = (unsigned long *)PTOV(*rootp & TABLE_MASK);
  8672.           ptrp += L2_INDEX(address);
  8673. --- 557,564 ----
  8674.                   free_pointer_table (ptrp);
  8675.               else if (!ptrp)
  8676.                   return -ENOMEM;
  8677. !             else
  8678. !               *rootp = VTOP(ptrp) | PAGE_TABLE;
  8679.           }
  8680.           ptrp = (unsigned long *)PTOV(*rootp & TABLE_MASK);
  8681.           ptrp += L2_INDEX(address);
  8682. ***************
  8683. *** 620,626 ****
  8684.                   free_pointer_table (ptrp);
  8685.               else if (!ptrp)
  8686.                   return -ENOMEM;
  8687. !             *rootp = VTOP(ptrp) | PAGE_TABLE;
  8688.           }
  8689.           ptrp = (unsigned long *)PTOV(*rootp & TABLE_MASK);
  8690.           ptrp += L2_INDEX(address);
  8691. --- 621,628 ----
  8692.                   free_pointer_table (ptrp);
  8693.               else if (!ptrp)
  8694.                   return -ENOMEM;
  8695. !             else
  8696. !               *rootp = VTOP(ptrp) | PAGE_TABLE;
  8697.           }
  8698.           ptrp = (unsigned long *)PTOV(*rootp & TABLE_MASK);
  8699.           ptrp += L2_INDEX(address);
  8700. diff -cr --new-file linux-0.9pl1/mm/swap.c linux-0.9pl2/mm/swap.c
  8701. *** linux-0.9pl1/mm/swap.c    Tue Jun 21 18:32:41 1994
  8702. --- linux-0.9pl2/mm/swap.c    Fri Aug  5 12:46:38 1994
  8703. ***************
  8704. *** 313,319 ****
  8705.   
  8706.   static int swap_out(unsigned int priority)
  8707.   {
  8708. !     static int swap_task;
  8709.       int table;
  8710.       int page;
  8711.       long pg_table;
  8712. --- 313,319 ----
  8713.   
  8714.   static int swap_out(unsigned int priority)
  8715.   {
  8716. !     static int swap_task = 1;
  8717.       int table;
  8718.       int page;
  8719.       long pg_table;
  8720. ***************
  8721. *** 689,695 ****
  8722.       unsigned long tmp = 0;
  8723.       struct task_struct *p;
  8724.   
  8725. !     nr = 0;
  8726.   /*
  8727.    * When we have to sleep, we restart the whole algorithm from the same
  8728.    * task we stopped in. That at least rids us of all races.
  8729. --- 689,695 ----
  8730.       unsigned long tmp = 0;
  8731.       struct task_struct *p;
  8732.   
  8733. !     nr = 1;
  8734.   /*
  8735.    * When we have to sleep, we restart the whole algorithm from the same
  8736.    * task we stopped in. That at least rids us of all races.
  8737. diff -cr --new-file linux-0.9pl1/tools/atari/bootstrap.c linux-0.9pl2/tools/atari/bootstrap.c
  8738. *** linux-0.9pl1/tools/atari/bootstrap.c    Wed Dec 31 19:00:00 1969
  8739. --- linux-0.9pl2/tools/atari/bootstrap.c    Fri Aug  5 12:47:22 1994
  8740. ***************
  8741. *** 0 ****
  8742. --- 1,558 ----
  8743. + /*
  8744. + ** bootstrap.c -- Load and launch the Atari Linux kernel
  8745. + **
  8746. + ** Copyright 1993 by Arjan Knor
  8747. + **
  8748. + ** This file is subject to the terms and conditions of the GNU General Public
  8749. + ** License.  See the file README.legal in the main directory of this archive
  8750. + ** for more details.
  8751. + **
  8752. + ** History:
  8753. + **      19 Feb 1994 Changed everything so that it works? (rdv)
  8754. + **      14 Mar 1994 New mini-copy routine used (rdv)
  8755. + */
  8756. + #include <stdio.h>
  8757. + #include <stdlib.h>
  8758. + #include <unistd.h>
  8759. + #include <stddef.h>
  8760. + #include <string.h>
  8761. + #include "sysvars.h"
  8762. + #include <osbind.h>
  8763. + #include <sys/types.h>
  8764. + #include <sys/file.h>
  8765. + /* linux specific include files */
  8766. + #include <linux/a.out.h>
  8767. + #include <linux/bootinfo.h>
  8768. + /* Atari bootstrap include file */
  8769. + #include "bootstrap.h"
  8770. + #define MIN_RAMSIZE     (3)    /* 3 MB */
  8771. + #define TEMP_STACKSIZE 256
  8772. + extern char *optarg;
  8773. + extern int optind;
  8774. + extern struct nlist *get_nlist(const char *fname, const char *symname);
  8775. + struct bootinfo bi;
  8776. + u_long *cookiejar;
  8777. + u_long userstk;
  8778. + /* getcookie -- function to get the value of the given cookie. */
  8779. + static int getcookie(char *cookie, u_long *value)
  8780. + {
  8781. +     int i = 0;
  8782. +     while(cookiejar[i] != 0L) {
  8783. +     if(cookiejar[i] == *(u_long *)cookie) {
  8784. +         *value = cookiejar[i + 1];
  8785. +         return 1;
  8786. +     }
  8787. +     i += 2;
  8788. +     }
  8789. +     return -1;
  8790. + }
  8791. + static void usage(void)
  8792. + {
  8793. +     fprintf(stderr, "Usage:\n"
  8794. +         "\tbootstrap [-d] [-k kernel_executable] [-r ramdisk_file]"
  8795. +         " [option...]\n");
  8796. +     exit(EXIT_FAILURE);
  8797. + }
  8798. + /*
  8799. +  * Copy the kernel and the ramdisk to their final resting places.
  8800. +  *
  8801. +  * I assume that the kernel data and the ramdisk reside somewhere
  8802. +  * in the middle of the memory.
  8803. +  *
  8804. +  * This program itself should be somewhere in the first 4096 bytes of memory
  8805. +  * where the kernel never will be. In this way it can never be overwritten
  8806. +  * by itself.
  8807. +  *
  8808. +  * At this point the registers have:
  8809. +  * a0: the start of the final kernel
  8810. +  * a1: the start of the current kernel
  8811. +  * a2: the end of the final ramdisk
  8812. +  * a3: the end of the current ramdisk
  8813. +  * d0: the kernel size
  8814. +  * d1: the ramdisk size 
  8815. +  */
  8816. + asm ("
  8817. + .text
  8818. + .globl _copyall, _copyallend
  8819. + _copyall:
  8820. +     movel    a0,a4            /* save the start of the kernel for booting */
  8821. + 1:    movel    a1@+,a0@+       /* copy the kernel starting at the beginning */
  8822. +     subql    #4,d0
  8823. +     jcc    1b
  8824. + 2:    movel    a3@-,a2@-       /* copy the ramdisk starting at the end */
  8825. +     subql    #4,d1
  8826. +     jcc    2b
  8827. +     jmp    a4@             /* jump to the start of the kernel */
  8828. + _copyallend:
  8829. + ");
  8830. + extern char copyall, copyallend;
  8831. + static void volatile boot_exit(int status)
  8832. + {
  8833. +     /* first go back to user mode */
  8834. +     (void)Super(userstk);
  8835. +     exit(status);
  8836. + }
  8837. + int main(int argc, char *argv[])
  8838. + {
  8839. +     int debugflag = 0, ch, kfd, rfd = -1, lang, i;
  8840. +     char *ramdisk_name, *kernel_name, *memptr;
  8841. +     u_long ST_ramsize, TT_ramsize, memreq;
  8842. +     u_long cpu_type, fpu_type, mch_type, mint, language;
  8843. +     struct nlist *nl;
  8844. +     struct exec kexec;
  8845. +     OSHEADER *os_header;
  8846. +     u_long start_mem, mem_size, rd_size, kbi_offset;
  8847. +     ramdisk_name = NULL;
  8848. +     kernel_name = "vmlinux";
  8849. +     /* print the startup message */
  8850. +     puts("\fLinux/68k Atari Bootstrap version 0.2");
  8851. +     puts("Copyright 1993,1994 by Arjan Knor, Robert de Vries\n");
  8852. +     /* machine is Atari */
  8853. +     bi.machtype = MACH_ATARI;
  8854. +     /* check arguments */
  8855. +     while ((ch = getopt(argc, argv, "dk:r:")) != EOF)
  8856. +     switch (ch) {
  8857. +       case 'd':
  8858. +         debugflag = 1;
  8859. +         break;
  8860. +       case 'k':
  8861. +         kernel_name = optarg;
  8862. +         break;
  8863. +       case 'r':
  8864. +         ramdisk_name = optarg;
  8865. +         break;
  8866. +       case '?':
  8867. +       default:
  8868. +         usage();
  8869. +     }
  8870. +     argc -= optind;
  8871. +     argv += optind;
  8872. +   
  8873. +     /* We have to access some system variables to get
  8874. +      * the information we need, so we must switch to
  8875. +      * supervisor mode first.
  8876. +      */
  8877. +     userstk = Super(0L);
  8878. +     /* get the info we need from the cookie-jar */
  8879. +     cookiejar = *_p_cookies;
  8880. +     if(cookiejar == 0L) {
  8881. +     /* if we find no cookies, it's probably an ST */
  8882. +     fprintf(stderr, "Error: No cookiejar found. Is this an ST?\n");
  8883. +     boot_exit(EXIT_FAILURE);
  8884. +     }
  8885. +     /* Exit if MiNT/MultiTOS is running.  */
  8886. +     if(getcookie("MiNT", &mint) != -1)
  8887. +     {
  8888. +     puts("Warning: MiNT is running\n");
  8889. + #if 0
  8890. +     puts("Linux cannot be started when MiNT is running. Aborting...\n");
  8891. +     boot_exit(EXIT_FAILURE);
  8892. + #endif
  8893. +     }
  8894. +     /* get _CPU, _FPU and _MCH */
  8895. +     getcookie("_CPU", &cpu_type);
  8896. +     getcookie("_FPU", &fpu_type);
  8897. +     getcookie("_MCH", &mch_type);
  8898. +     /* First determine what machine we are on */
  8899. +     mch_type = mch_type >> 16;
  8900. +     printf("Machine = ");
  8901. +     switch(mch_type)
  8902. +     {
  8903. +       case MACH_ST:
  8904. +     puts("ST\n");
  8905. +     break;
  8906. +       case MACH_STE:
  8907. +     puts("STE\n");
  8908. +     break;
  8909. +       case MACH_TT:
  8910. +     puts("TT\n");
  8911. +     break;
  8912. +       case MACH_FALCON:
  8913. +     puts("Falcon\n");
  8914. +     break;
  8915. +       default:
  8916. +     printf("UNKNOWN (%ld)\n\n", mch_type);
  8917. +     break;
  8918. +     }
  8919. +     /* check if we are on a 68030 */
  8920. +     if (cpu_type != 30)
  8921. +     {
  8922. +     puts("Machine type currently not supported. Aborting...");
  8923. +     boot_exit(EXIT_FAILURE);
  8924. +     }
  8925. +     switch(cpu_type) {
  8926. +       case  0:
  8927. +       case 10: break;
  8928. +       case 20: bi.cputype = CPU_68020; break;
  8929. +       case 30: bi.cputype = CPU_68030; break;
  8930. +       case 40: bi.cputype = CPU_68040; break;
  8931. +       default:
  8932. +     fprintf(stderr, "Error: Unknown CPU type. Aborting...\n");
  8933. +     boot_exit(EXIT_FAILURE);
  8934. +     break;
  8935. +     }
  8936. +     printf("CPU: %ld; ", cpu_type + 68000);
  8937. +     printf("FPU: ");
  8938. +     /* check for FPU */
  8939. +     switch(fpu_type >> 16)
  8940. +     {
  8941. +       case 0:
  8942. +     puts("not present\n");
  8943. +     break;
  8944. +       case 2:
  8945. +     /* try to determine real type */
  8946. +     if (fpu_idle_frame_size () != 0x18)
  8947. +         goto m68882;
  8948. +     /* fall through */
  8949. +       case 4:
  8950. +     bi.cputype |= FPU_68881;
  8951. +     puts("68881\n");
  8952. +     break;
  8953. +       case 6:
  8954. +       m68882:
  8955. +     bi.cputype |= FPU_68882;
  8956. +     puts("68882\n");
  8957. +     break;
  8958. +       default:
  8959. +     puts("Unknown FPU type. Assuming no FPU.");
  8960. +     break;
  8961. +     }
  8962. +     if (mch_type == MACH_TT)
  8963. +     bi.bi_atari.model = ATARI_TT;
  8964. +     else if (mch_type == MACH_FALCON)
  8965. +     bi.bi_atari.model = ATARI_FALCON;
  8966. +     else if ((mch_type == MACH_STE) && (cpu_type == 30))
  8967. +     bi.bi_atari.model = ATARI_FALCON; /* this is for my beta-falcon (rdv) */
  8968. +     else
  8969. +     {
  8970. +     fprintf(stderr, "Error: unsupported atari type. Aborting...\n");
  8971. +     boot_exit(EXIT_FAILURE);
  8972. +     }
  8973. +     /* Get the amounts of ST- and TT-RAM. */
  8974. +     /* The size must be a multiple of 1MB. */
  8975. +     i = 0;
  8976. +     TT_ramsize = 0;
  8977. +     if (mch_type == MACH_TT && *ramtop) {
  8978. +     /* the 'ramtop' variable at 0x05a4 is not
  8979. +      * officially documented. We use it anyway
  8980. +      * because it is the only way to get the TTram size.
  8981. +      * (It is zero if there is no TTram.)
  8982. +      */
  8983. +     bi.memory[i].addr = TT_RAM_BASE;
  8984. +     bi.memory[i].size = (*ramtop - TT_RAM_BASE) & ~(MB - 1);
  8985. +     TT_ramsize = bi.memory[i].size / MB;
  8986. +     i++;
  8987. +     printf("TT-RAM: %ld Mb; ", TT_ramsize);
  8988. +     }
  8989. +     bi.memory[i].addr = PAGE_SIZE; /* do not use the exception space
  8990. +                    (this comes down to the first page) */
  8991. +     bi.memory[i].size = (*phystop - bi.memory[i].addr) & ~(MB - 1);
  8992. +     ST_ramsize = bi.memory[i].size / MB;
  8993. +     bi.bi_atari.stram_start = bi.memory[i].addr + bi.memory[i].size;
  8994. +     bi.bi_atari.stram_size = *phystop - bi.bi_atari.stram_start;
  8995. +     i++;
  8996. +     printf("ST-RAM: %ld Mb; %ld Kb unmapped; ", ST_ramsize,
  8997. +        bi.bi_atari.stram_size / 1024);
  8998. +     bi.num_memory = i;
  8999. +     /* verify that there is enough RAM; ST- and TT-RAM combined */
  9000. +     if (ST_ramsize + TT_ramsize < MIN_RAMSIZE) {
  9001. +     puts("Not enough RAM. Aborting...");
  9002. +     boot_exit(10);
  9003. +     }
  9004. +     /* Get language/keyboard info */
  9005. +     /* TODO: do we need this ? */
  9006. +     /* Could be used to auto-select keyboard map later on. (rdv) */
  9007. +     if (getcookie("_AKP",&language) == -1)
  9008. +     {
  9009. +     /* Get the language info from the OS-header */
  9010. +     os_header = *_sysbase;
  9011. +     os_header = os_header->os_beg;
  9012. +     lang = (os_header->os_conf) >> 1;
  9013. +     printf("Language: ");
  9014. +     switch(lang) {
  9015. +       case HOL: puts("Dutch"); break; /* Own country first :-) */
  9016. +       case USA: puts("American"); break;
  9017. +       case SWG: puts("Switzerland (German)"); break;
  9018. +       case FRG: puts("German"); break;
  9019. +       case FRA: puts("French"); break;
  9020. +       case SWF: puts("Switzerland (French)"); break;
  9021. +       case UK:  puts("English"); break;
  9022. +       case SPA: puts("Spanish"); break;
  9023. +       case ITA: puts("Italian"); break;
  9024. +       case SWE: puts("Swedish"); break;
  9025. +       case TUR: puts("Turkey"); break;
  9026. +       case FIN: puts("Finnish"); break;
  9027. +       case NOR: puts("Norwegian"); break;
  9028. +       case DEN: puts("Danish"); break;
  9029. +       case SAU: puts("Saudi-Arabian"); break;
  9030. +       default:  puts("Unknown"); break;
  9031. +     }
  9032. +     }
  9033. +     else
  9034. +     {
  9035. +     printf("Language: ");
  9036. +     switch(language & 0x0F)
  9037. +     {
  9038. +       case 1: printf("German "); break;
  9039. +       case 2: printf("French "); break;
  9040. +       case 4: printf("Spanish "); break;
  9041. +       case 5: printf("Italian "); break;
  9042. +       case 7: printf("Swiss French "); break;
  9043. +       case 8: printf("Swiss German "); break;
  9044. +       default: printf("English ");
  9045. +     }
  9046. +     printf("Keyboard type :");
  9047. +     switch(language >> 8)
  9048. +     {
  9049. +       case 1: printf("German "); break;
  9050. +       case 2: printf("French "); break;
  9051. +       case 4: printf("Spanish "); break;
  9052. +       case 5: printf("Italian "); break;
  9053. +       case 7: printf("Swiss French "); break;
  9054. +       case 8: printf("Swiss German "); break;
  9055. +       default: printf("English ");
  9056. +     }
  9057. +     printf("\n");
  9058. +     }
  9059. +     /*
  9060. +      * Copy command line options into the kernel command line.
  9061. +      */
  9062. +     i = 0;
  9063. +     while (argc--) {
  9064. +     if ((i+strlen(*argv)+1) < CL_SIZE) {
  9065. +         i += strlen(*argv) + 1;
  9066. +         if (bi.command_line[0])
  9067. +         strcat (bi.command_line, " ");
  9068. +         strcat (bi.command_line, *argv++);
  9069. +     }
  9070. +     }
  9071. +     printf ("Command line is '%s'\n", bi.command_line);
  9072. +     start_mem = bi.memory[0].addr;
  9073. +     mem_size = bi.memory[0].size;
  9074. +     /* tell us where the kernel will go */
  9075. +     printf("\nThe kernel will be located at 0x%08lx\n", start_mem);
  9076. + #ifdef TEST
  9077. +     /*
  9078. +     ** Temporary exit point for testing
  9079. +     */
  9080. +     boot_exit(-1);
  9081. + #endif /* TEST */
  9082. +     /* open kernel executable and read exec header */
  9083. +     if ((kfd = open (kernel_name, O_RDONLY)) == -1) {
  9084. +     fprintf (stderr, "Unable to open kernel file %s\n", kernel_name);
  9085. +     boot_exit (EXIT_FAILURE);
  9086. +     }
  9087. +     if (read (kfd, (void *)&kexec, sizeof(kexec)) != sizeof(kexec))
  9088. +     {
  9089. +     fprintf (stderr, "Unable to read exec header from %s\n", kernel_name);
  9090. +     boot_exit (EXIT_FAILURE);
  9091. +     }
  9092. +     /* init ramdisk */
  9093. +     if(ramdisk_name) {
  9094. +     if((rfd = open(ramdisk_name, O_RDONLY)) == -1) {
  9095. +         fprintf(stderr, "Unable to open ramdisk file %s\n",
  9096. +             ramdisk_name);
  9097. +         boot_exit(EXIT_FAILURE);
  9098. +     }
  9099. +     bi.ramdisk_size = (lseek(rfd, 0, SEEK_END) + 1023) / 1024;
  9100. +     }
  9101. +     else
  9102. +     bi.ramdisk_size = 0;
  9103. +     rd_size = bi.ramdisk_size << 10;
  9104. +     bi.ramdisk_addr = (u_long)start_mem + mem_size - rd_size;
  9105. +     /* find offset to boot_info structure */
  9106. +     if (!(nl = get_nlist (kernel_name, "_boot_info")))
  9107. +     {
  9108. +     perror ("get_nlist");
  9109. +     boot_exit (EXIT_FAILURE);
  9110. +     }
  9111. +     kbi_offset = nl->n_value - kexec.a_entry;
  9112. +     free (nl);
  9113. +     /* calculate the total required amount of memory */
  9114. +     memreq = kexec.a_text + kexec.a_data + kexec.a_bss + rd_size;
  9115. +  
  9116. +     /* allocate RAM for the kernel */
  9117. +     if (!(memptr = (char *)Malloc (memreq)))
  9118. +     {
  9119. +     fprintf (stderr, "Unable to allocate memory\n");
  9120. +     boot_exit (EXIT_FAILURE);
  9121. +     }
  9122. +     else
  9123. +     fprintf(stderr, "kernel at address %lx\n", (u_long) memptr);
  9124. +     (void)memset(memptr, 0, memreq);
  9125. +     /* read the text and data segments from the kernel image */
  9126. +     if (lseek (kfd, N_TXTOFF(kexec), SEEK_SET) == -1)
  9127. +     {
  9128. +     fprintf (stderr, "Failed to seek to text\n");
  9129. +     Mfree ((void *)memptr);
  9130. +     boot_exit (EXIT_FAILURE);
  9131. +     }
  9132. +     if (read (kfd, memptr, kexec.a_text) != kexec.a_text)
  9133. +     {
  9134. +     fprintf (stderr, "Failed to read text\n");
  9135. +     Mfree ((void *)memptr);
  9136. +     boot_exit (EXIT_FAILURE);
  9137. +     }
  9138. +     if (lseek (kfd, N_DATOFF(kexec), SEEK_SET) == -1)
  9139. +     {
  9140. +     fprintf (stderr, "Failed to seek to data\n");
  9141. +     Mfree ((void *)memptr);
  9142. +     boot_exit (EXIT_FAILURE);
  9143. +     }
  9144. +     if (read (kfd, memptr + kexec.a_text, kexec.a_data) != kexec.a_data)
  9145. +     {
  9146. +     fprintf (stderr, "Failed to read data\n");
  9147. +     Mfree ((void *)memptr);
  9148. +     boot_exit (EXIT_FAILURE);
  9149. +     }
  9150. +     close (kfd);
  9151. +     /* copy the boot_info struct to the kernel image */
  9152. +     memcpy ((void *)(memptr + kbi_offset), &bi, sizeof(bi));
  9153. +     /* read the ramdisk image */
  9154. +     if (rfd != -1)
  9155. +     {
  9156. +     if (lseek (rfd, 0, SEEK_SET) == -1)
  9157. +     {
  9158. +         fprintf (stderr, "Failed to seek to beginning of ramdisk file\n");
  9159. +         Mfree ((void *)memptr);
  9160. +         boot_exit (EXIT_FAILURE);
  9161. +     }
  9162. +     if (read (rfd, memptr + kexec.a_text + kexec.a_data + kexec.a_bss,
  9163. +           rd_size) != rd_size)
  9164. +     {
  9165. +         fprintf (stderr, "Failed to read ramdisk file\n");
  9166. +         Mfree ((void *)memptr);
  9167. +         boot_exit (EXIT_FAILURE);
  9168. +     }
  9169. +     close (rfd);
  9170. +     }
  9171. +     /* for those who want to debug */
  9172. +     if (debugflag)
  9173. +     {
  9174. +     if (bi.ramdisk_size)
  9175. +         printf ("RAM disk at %#lx, size is %ldK\n",
  9176. +             (u_long)memptr + kexec.a_text + kexec.a_data + kexec.a_bss,
  9177. +             bi.ramdisk_size);
  9178. +     printf ("\nKernel text at %#lx, code size %d\n",
  9179. +         start_mem + N_TXTADDR(kexec), kexec.a_text);
  9180. +     printf ("Kernel data at %#lx, data size %d\n",
  9181. +         start_mem + N_DATADDR(kexec), kexec.a_data );
  9182. +     printf ("Kernel bss  at %#lx, bss  size %d\n",
  9183. +         start_mem + N_BSSADDR(kexec), kexec.a_bss );
  9184. +     printf ("\nKernel boot_info is at %#lx physical, %#lx virtual\n",
  9185. +         start_mem + kbi_offset, kexec.a_entry + kbi_offset);
  9186. +     printf ("\nKernel entry is %#x\n", kexec.a_entry );
  9187. +     printf ("ramdisk dest top is %#lx\n", start_mem + mem_size);
  9188. +     printf ("ramdisk lower limit is %#lx\n",
  9189. +         (u_long)(memptr + kexec.a_text + kexec.a_data + kexec.a_bss));
  9190. +     printf ("ramdisk src top is %#lx\n",
  9191. +         (u_long)(memptr + kexec.a_text + kexec.a_data + kexec.a_bss) +
  9192. +         rd_size);
  9193. +     printf ("Type a key to continue the Linux boot...");
  9194. +     fflush (stdout);
  9195. +     getchar();
  9196. +     }
  9197. +     printf("Booting Linux...\n");
  9198. +     sync ();
  9199. +     /* turn off interrupts... */
  9200. +     disable_interrupts();
  9201. +     /* turn off caches... */
  9202. +     disable_cache();
  9203. +     /* ..and any MMU translation */
  9204. +     disable_mmu();
  9205. +     /* copy mover code to a safe place */
  9206. +     memcpy((void*)0x400, ©all, ©allend - ©all);
  9207. +     /* setup stack */
  9208. +     change_stack((void*)PAGE_SIZE);
  9209. +     /*
  9210. +      * On the Atari you can have two situations:
  9211. +      * 1. One piece of contiguous RAM (Falcon)
  9212. +      * 2. Two pieces of contiguous RAM (TT)
  9213. +      * In case 2 you can load your program into ST-ram and load your data in
  9214. +      * any old RAM you have left.
  9215. +      * In case 1 you could overwrite your own program when copying the
  9216. +      * kernel and ramdisk to their final positions.
  9217. +      * To solve this the mover code is copied to a safe place first.
  9218. +      * Then this program jumps to the mover code. After the mover code
  9219. +      * has finished it jumps to the start of the kernel in its new position.
  9220. +      * I thought the memory just after the interrupt vector table was a safe
  9221. +      * place because it is used by TOS to store some system variables.
  9222. +      * This range goes from 0x400 to approx. 0x5B0.
  9223. +      * This is more than enough for the miniscule mover routine (16 bytes).
  9224. +      */
  9225. +     
  9226. +     jump_to_mover((char *) start_mem, memptr,
  9227. +           (char *) start_mem + mem_size, memptr + memreq,
  9228. +           kexec.a_text + kexec.a_data + kexec.a_bss,
  9229. +           rd_size,
  9230. +           (void*)0x400);
  9231. +     for (;;);
  9232. +     /* NOTREACHED */
  9233. + }
  9234. diff -cr --new-file linux-0.9pl1/tools/atari/bootstrap.h linux-0.9pl2/tools/atari/bootstrap.h
  9235. *** linux-0.9pl1/tools/atari/bootstrap.h    Wed Dec 31 19:00:00 1969
  9236. --- linux-0.9pl2/tools/atari/bootstrap.h    Fri Aug  5 12:47:23 1994
  9237. ***************
  9238. *** 0 ****
  9239. --- 1,118 ----
  9240. + /*
  9241. + ** bootstrap.h -- This file is a part of the Atari bootloader.
  9242. + **
  9243. + ** Copyright 1993 by Arjan Knor
  9244. + **
  9245. + ** Modified by Andreas Schwab
  9246. + ** - clear transparent translation registers
  9247. + **
  9248. + ** This file is subject to the terms and conditions of the GNU General Public
  9249. + ** License.  See the file README.legal in the main directory of this archive
  9250. + ** for more details.
  9251. + **
  9252. + */
  9253. + #ifndef BOOTSTRAP_H
  9254. + #define BOOTSTRAP_H
  9255. + /* _MCH cookie values */
  9256. + #define MACH_ST  0
  9257. + #define MACH_STE 1
  9258. + #define MACH_TT  2
  9259. + #define MACH_FALCON 3
  9260. + /* some constants for memory handling */
  9261. + #define ST_RAM 0
  9262. + #define TT_RAM 1
  9263. + #define TT_RAM_BASE  (u_long)(0x01000000)
  9264. + #define MB           (1024 * 1024)
  9265. + #define START_MEM    (bi.memory[0].addr)
  9266. + #define MEM_SIZE     (bi.memory[0].size)
  9267. + /* the various CPU- and FPU-types */
  9268. + #define AFF_68000 (1)
  9269. + #define AFF_68020 (2)
  9270. + #define AFF_68030 (4)
  9271. + #define AFF_68040 (8)
  9272. + #define AFF_68881 (16)
  9273. + #define AFF_68882 (32)
  9274. + /* the possible OS-languages */
  9275. + #define USA 0
  9276. + #define FRG 1
  9277. + #define FRA 2
  9278. + #define UK  3
  9279. + #define SPA 4
  9280. + #define ITA 5
  9281. + #define SWE 6
  9282. + #define SWF 7
  9283. + #define SWG 8
  9284. + #define TUR 9
  9285. + #define FIN 10
  9286. + #define NOR 11
  9287. + #define DEN 12
  9288. + #define SAU 13
  9289. + #define HOL 14
  9290. + /* some inline functions */
  9291. + /* TODO: update cache-control for '040 use */
  9292. + static __inline int fpu_idle_frame_size (void)
  9293. + {
  9294. +   char fpu_frame[216];
  9295. +   __asm__ __volatile__ ("fnop"::);
  9296. +   __asm__ __volatile__ ("fsave %0@" : : "a" (fpu_frame));
  9297. +   return fpu_frame[1];
  9298. + }
  9299. + static __inline void change_stack (u_long *stackp)
  9300. + {
  9301. +     __asm__ volatile ("movel %0,sp\n\t" :: "g" (stackp) : "sp");
  9302. + }
  9303. + static __inline void disable_interrupts (void)
  9304. + {
  9305. +   __asm__ volatile ("orw #0x700,sr":);
  9306. + }
  9307. + static __inline void disable_cache (void)
  9308. + {
  9309. +     __asm__ volatile ("movec %0,cacr" :: "d" (0));
  9310. + }
  9311. + static __inline void disable_mmu (void)
  9312. + {
  9313. +     __asm__ volatile ("subl  #4,sp\n\t"
  9314. +               "pmove tc,sp@\n\t"
  9315. +               "bclr  #7,sp@\n\t"
  9316. +               "pmove sp@,tc\n\t"
  9317. +               "clrl sp@\n\t"
  9318. +               ".long 0xf0170800\n\t" /* pmove sp@,tt0 */
  9319. +               ".long 0xf0170c00\n\t" /* pmove sp@,tt1 */
  9320. +               "addl  #4,sp\n");
  9321. + }
  9322. + static __inline void jump_to_mover (void *, void *, void *, void *, int, int,
  9323. +                     void *) __attribute__ ((noreturn));
  9324. + static __inline void jump_to_mover (void *kernel_start, void *mem_start,
  9325. +                     void *ramdisk_end, void *mem_end,
  9326. +                     int kernel_size, int ramdisk_size,
  9327. +                     void *mover_addr)
  9328. + {
  9329. +     asm volatile ("movel %0,a0\n\t"
  9330. +           "movel %1,a1\n\t"
  9331. +           "movel %2,a2\n\t"
  9332. +           "movel %3,a3\n\t"
  9333. +           "movel %4,d0\n\t"
  9334. +           "movel %5,d1\n\t"
  9335. +           "jmp   %6@\n"
  9336. +           : /* no outputs */
  9337. +           : "g" (kernel_start), "g" (mem_start),
  9338. +             "g" (ramdisk_end), "g" (mem_end),
  9339. +             "g" (kernel_size), "g" (ramdisk_size),
  9340. +             "a" (mover_addr)
  9341. +           : "a0", "a1", "a2", "a3", "d0", "d1");
  9342. + }
  9343. + #endif /* BOOTSTRAP_H */
  9344. diff -cr --new-file linux-0.9pl1/tools/atari/get_nlist.c linux-0.9pl2/tools/atari/get_nlist.c
  9345. *** linux-0.9pl1/tools/atari/get_nlist.c    Wed Dec 31 19:00:00 1969
  9346. --- linux-0.9pl2/tools/atari/get_nlist.c    Fri Aug  5 12:47:24 1994
  9347. ***************
  9348. *** 0 ****
  9349. --- 1,97 ----
  9350. + /*
  9351. + ** get_nlist.c -- This file contains the routines for getting a symbol
  9352. + **          table entry when booting the Amiga Linux kernel.
  9353. + **
  9354. + ** Copyright 1993 by Hamish Macdonald, Arjan Knor
  9355. + **
  9356. + ** This file is subject to the terms and conditions of the GNU General Public
  9357. + ** License.  See the file README.legal in the main directory of this archive
  9358. + ** for more details.
  9359. + **
  9360. + */
  9361. + #include <stdlib.h>
  9362. + #include <stdio.h>
  9363. + #include <fcntl.h>    /* has to be sys/fcntl.h ?? */
  9364. + #include <unistd.h>
  9365. + #include <linux/a.out.h>
  9366. + struct nlist *get_nlist (const char *fname, const char *symname)
  9367. + {
  9368. +     int fd = open (fname, O_RDONLY);
  9369. +     struct exec ex;
  9370. +     struct nlist *nl, *p = NULL, *syms;
  9371. +     char *strs;
  9372. +     long filesize;
  9373. +     long strsize, numsyms;
  9374. +     if (fd == -1)
  9375. +     return NULL;
  9376. + #ifdef DEBUG
  9377. +     printf ("fd is %d\n", fd);
  9378. + #endif
  9379. +     read (fd, &ex, sizeof(ex));
  9380. +     if (!ex.a_syms) {
  9381. +     close (fd);
  9382. +     return NULL;
  9383. +     }
  9384. + #ifdef DEBUG
  9385. +     printf ("%d bytes of symbol data\n", ex.a_syms);
  9386. + #endif
  9387. +     syms = (struct nlist *)malloc (ex.a_syms);
  9388. +     if (!syms) {
  9389. +     close (fd);
  9390. +     return NULL;
  9391. +     }
  9392. +     lseek (fd, N_SYMOFF(ex), SEEK_SET);
  9393. +     read (fd, syms, ex.a_syms);
  9394. +     numsyms = ex.a_syms / sizeof (struct nlist);
  9395. + #ifdef DEBUG
  9396. +     printf ("there are %d symbols\n", numsyms);
  9397. + #endif
  9398. +     filesize = lseek (fd, 0L, SEEK_END);
  9399. + #ifdef DEBUG
  9400. +     printf ("there are %d characters in the file\n", filesize);
  9401. + #endif
  9402. +     strsize = filesize - N_STROFF(ex);
  9403. + #ifdef DEBUG
  9404. +     printf ("%d characters in the string table\n", strsize);
  9405. + #endif
  9406. +     strs = (char *)malloc (strsize);
  9407. +     if (!strs) {
  9408. +     free (syms);
  9409. +     close (fd);
  9410. +     return NULL;
  9411. +     }
  9412. +     lseek (fd, N_STROFF(ex), SEEK_SET);
  9413. +     read (fd, strs, strsize);
  9414. +     for (nl = syms; nl < syms + numsyms; nl++) {
  9415. + #ifdef DEBUG
  9416. +     printf ("checking symbol number %d, name %s\n",
  9417. +         nl - syms, strs + nl->n_un.n_strx);
  9418. + #endif
  9419. +     if (strcmp (symname, strs + nl->n_un.n_strx) == 0
  9420. +         && nl->n_type == N_BSS | N_EXT) {
  9421. +         p = (struct nlist *)malloc (sizeof (struct nlist)
  9422. +                     + strlen(strs + nl->n_un.n_strx) + 1);
  9423. +         if (!p)
  9424. +         break;
  9425. +         *p = *nl;
  9426. +         p->n_un.n_name = (char *)(p+1);
  9427. +         strcpy (p->n_un.n_name, strs + nl->n_un.n_strx);
  9428. +     }
  9429. +     }
  9430. +     free (strs);
  9431. +     free (syms);
  9432. +     close (fd);
  9433. +     return p;
  9434. + }
  9435. diff -cr --new-file linux-0.9pl1/tools/atari/sysvars.h linux-0.9pl2/tools/atari/sysvars.h
  9436. *** linux-0.9pl1/tools/atari/sysvars.h    Wed Dec 31 19:00:00 1969
  9437. --- linux-0.9pl2/tools/atari/sysvars.h    Fri Aug  5 12:47:24 1994
  9438. ***************
  9439. *** 0 ****
  9440. --- 1,22 ----
  9441. + typedef struct _osheader
  9442. + {
  9443. +   unsigned short os_entry;
  9444. +   unsigned short os_version;
  9445. +   void *reseth;
  9446. +   struct _osheader *os_beg;
  9447. +   void *os_end;
  9448. +   long os_rsv1;
  9449. +   void *os_magic;
  9450. +   long os_date;
  9451. +   unsigned short os_conf;
  9452. +   unsigned short os_dosdate;
  9453. +   char **p_root;
  9454. +   unsigned char **pkbshift;
  9455. +   void **p_run;
  9456. +   char *p_rsv2;
  9457. + } OSHEADER;
  9458. + #define phystop    ((unsigned long *)0x42e)
  9459. + #define _sysbase   ((OSHEADER **)0x4f2)
  9460. + #define _p_cookies ((unsigned long **)0x5a0)
  9461. + #define ramtop     ((unsigned long *)0x5a4)
  9462.